Ejemplo n.º 1
0
void
sighandler(int sig)
{
	switch (sig) {
	case SIGHUP:
		gaim_debug_warning("sighandler", "Caught signal %d\n", sig);
		gaim_connections_disconnect_all();
		break;
	case SIGSEGV:
#ifndef DEBUG
		fprintf(stderr, "Gaim has segfaulted and attempted to dump a core file.\n"
			"This is a bug in the software and has happened through\n"
			"no fault of your own.\n\n"
			"It is possible that this bug is already fixed in CVS.\n"
			"If you can reproduce the crash, please notify the gaim\n"
			"maintainers by reporting a bug at\n"
			GAIM_WEBSITE "bug.php\n\n"
			"Please make sure to specify what you were doing at the time,\n"
			"and post the backtrace from the core file. If you do not know\n"
			"how to get the backtrace, please get instructions at\n"
			GAIM_WEBSITE "gdb.php. If you need further\n"
			"assistance, please IM either SeanEgn or LSchiere and\n"
			"they can help you.\n");
#else
		fprintf(stderr, "Hi, user.  We need to talk.\n"
			"I think something's gone wrong here.  It's probably my fault.\n"
			"No, really, it's not you... it's me... no no no, I think we get along well\n"
			"it's just that.... well, I want to see other people.  I... what?!?  NO!  I haven't\n"
			"been cheating on you!!  How many times do you want me to tell you?!  And for the\n"
			"last time, it's just a rash!\n");
		/*g_on_error_query (g_get_prgname());*/
#endif
		abort();
		break;
	case SIGCHLD:
		clean_pid();
		signal(SIGCHLD, sighandler);    /* restore signal catching on this one! */
		break;
	default:
		gaim_debug_warning("sighandler", "Caught signal %d\n", sig);
		gaim_connections_disconnect_all();

		gaim_plugins_unload_all();

		if (gtk_main_level())
			gtk_main_quit();
		exit(0);
	}
}
Ejemplo n.º 2
0
static void
reap_child(GPid pid, gint status, gpointer data)
{
	ChildProcess *cp = data;
	if (cp->callback) {
		cp->callback(status, cp->data);
	}
	g_free(cp);
	clean_pid();
	wm->mode = GNT_KP_MODE_NORMAL;
	endwin();
	setup_io();
	refresh();
	refresh_screen();
}
Ejemplo n.º 3
0
static gboolean
mainloop_sighandler(GIOChannel *source, GIOCondition cond, gpointer data)
{
	GIOStatus stat;
	int sig;
	gsize bytes_read;
	GError *error = NULL;

	/* read the signal number off of the io channel */
	stat = g_io_channel_read_chars(source, (gchar *)&sig, sizeof(int),
			&bytes_read, &error);
	if (stat != G_IO_STATUS_NORMAL) {
		purple_debug_error("sighandler", "Signal callback failed to read "
				"from signal socket: %s", error->message);
		purple_core_quit();
		return FALSE;
	}

	switch (sig) {
#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
/* By default, gstreamer forks when you initialize it, and waitpids for the
 * child.  But if libpurple reaps the child rather than leaving it to
 * gstreamer, gstreamer's initialization fails.  So, we wait a second before
 * reaping child processes, to give gst a chance to reap it if it wants to.
 *
 * This is not needed in later gstreamers, which let us disable the forking.
 * And, it breaks the world on some Real Unices.
 */
	case SIGCHLD:
		/* Restore signal catching */
		signal(SIGCHLD, sighandler);
		alarm(1);
		break;
	case SIGALRM:
#else
	case SIGCHLD:
#endif
		clean_pid();
		/* Restore signal catching */
		signal(SIGCHLD, sighandler);
		break;
	default:
		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
		purple_core_quit();
	}

	return TRUE;
}
Ejemplo n.º 4
0
static void
sighandler(int sig)
{
	switch (sig) {
#ifdef SIGWINCH
	case SIGWINCH:
		erase();
		g_idle_add((GSourceFunc)refresh_screen, NULL);
		if (org_winch_handler)
			org_winch_handler(sig);
		signal(SIGWINCH, sighandler);
		break;
#endif
	case SIGCHLD:
		clean_pid();
		signal(SIGCHLD, sighandler);
		break;
	case SIGINT:
		ask_before_exit();
		signal(SIGINT, sighandler);
		break;
	}
}