Mercurial > pidgin.yaz
diff pidgin/gtkmain.c @ 30909:25e200cb3532
propagate from branch 'im.pidgin.pidgin' (head dca20e09164518b0f7a773edd7e9649f41d8873d)
to branch 'im.pidgin.cpw.malu.xmpp.google_refactor' (head 7823c556f2d1bbca43f5ef9f0fea30cabc5d313f)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Tue, 31 Aug 2010 18:28:10 +0000 |
parents | f30a02140f74 |
children | db41f73ac3b6 |
line wrap: on
line diff
--- a/pidgin/gtkmain.c Fri Apr 09 22:14:51 2010 +0000 +++ b/pidgin/gtkmain.c Tue Aug 31 18:28:10 2010 +0000 @@ -97,7 +97,6 @@ */ static const int catch_sig_list[] = { SIGSEGV, - SIGHUP, SIGINT, SIGTERM, SIGQUIT, @@ -167,7 +166,7 @@ if ((pid == (pid_t) - 1) && (errno != ECHILD)) { char errmsg[BUFSIZ]; - snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); + snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid); perror(errmsg); } } @@ -223,9 +222,6 @@ } switch (sig) { - case SIGHUP: - purple_debug_warning("sighandler", "Caught signal %d\n", sig); - break; #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 @@ -539,16 +535,18 @@ char errmsg[BUFSIZ]; GIOChannel *signal_channel; GIOStatus signal_status; + guint signal_channel_watcher; #ifndef DEBUG char *segfault_message_tmp; #endif - GError *error = NULL; + GError *error; #endif int opt; gboolean gui_check; gboolean debug_enabled; gboolean migration_failed = FALSE; GList *active_accounts; + struct stat st; struct option long_options[] = { {"config", required_argument, NULL, 'c'}, @@ -608,6 +606,7 @@ /* we have to convert the message (UTF-8 to console charset) early because after a segmentation fault it's not a good practice to allocate memory */ + error = NULL; segfault_message = g_locale_from_utf8(segfault_message_tmp, -1, NULL, NULL, &error); if (segfault_message != NULL) { @@ -652,7 +651,8 @@ "binary: %s", error->message); exit(1); } - g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL); + signal_channel_watcher = g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL); + g_io_channel_unref(signal_channel); /* Let's not violate any PLA's!!!! */ /* jseymour: whatever the fsck that means */ @@ -660,31 +660,31 @@ * useful signals like SIGCHLD, so we unblock all the ones we * * declare a handler for. thanks JSeymour and Vann. */ if (sigemptyset(&sigset)) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't initialise empty signal set"); perror(errmsg); } for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d for catching", catch_sig_list[sig_indx]); perror(errmsg); } if(sigaddset(&sigset, catch_sig_list[sig_indx])) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't include signal %d for unblocking", catch_sig_list[sig_indx]); perror(errmsg); } } for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d to ignore", ignore_sig_list[sig_indx]); perror(errmsg); } } if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { - snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); + snprintf(errmsg, sizeof(errmsg), "Warning: couldn't unblock signals"); perror(errmsg); } #endif @@ -850,6 +850,8 @@ * in user's home directory. */ search_path = g_build_filename(purple_user_dir(), "plugins", NULL); + if (!g_stat(search_path, &st)) + g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR); purple_plugins_add_search_path(search_path); g_free(search_path); purple_plugins_add_search_path(LIBDIR); @@ -977,6 +979,9 @@ #ifdef HAVE_SIGNAL_H g_free(segfault_message); + g_source_remove(signal_channel_watcher); + close(signal_sockets[0]); + close(signal_sockets[1]); #endif #ifdef _WIN32