components/desktop/pidgin/patches/pidgin-22-remove-sigchld-handler.patch
changeset 7277 a51b37054c45
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/pidgin/patches/pidgin-22-remove-sigchld-handler.patch	Wed Nov 09 09:08:47 2016 -0800
@@ -0,0 +1,105 @@
+Remove SIGCHLD signal handler.
+
+DNS processes are already reaped in libpurple. Sound processes are
+reaped after 15 seconds. Other processes are sent through GLib and
+reaped by it. Anyway, this means we can stop preventing GStreamer
+from forking, and maybe fix a D-Bus bug, or something.
+
+Fixes #5553 - https://developer.pidgin.im/ticket/5553
+Fixes #7902 - https://developer.pidgin.im/ticket/7902
+
+(This patch is also included with the Debian version of pidgin.)
+
+--- pidgin-2.11.0/pidgin/gtkmain.c.orig	2016-11-08 10:49:01.655270291 +0000
++++ pidgin-2.11.0/pidgin/gtkmain.c	2016-11-08 10:52:39.758701309 +0000
+@@ -88,10 +88,6 @@
+ 	SIGINT,
+ 	SIGTERM,
+ 	SIGQUIT,
+-	SIGCHLD,
+-#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+-	SIGALRM,
+-#endif
+ 	-1
+ };
+ 
+@@ -134,31 +130,6 @@
+ 
+ static int signal_sockets[2];
+ 
+-static void sighandler(int sig);
+-
+-/*
+- * This child process reaping stuff is currently only used for processes that
+- * were forked to play sounds.  It's not needed for forked DNS child, which
+- * have their own waitpid() call.  It might be wise to move this code into
+- * gtksound.c.
+- */
+-static void
+-clean_pid(void)
+-{
+-	int status;
+-	pid_t pid;
+-
+-	do {
+-		pid = waitpid(-1, &status, WNOHANG);
+-	} while (pid != 0 && pid != (pid_t)-1);
+-
+-	if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
+-		char errmsg[BUFSIZ];
+-		snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid);
+-		perror(errmsg);
+-	}
+-}
+-
+ static void sighandler(int sig)
+ {
+ 	ssize_t written;
+@@ -209,33 +180,8 @@
+ 		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();
+-	}
++	purple_debug_warning("sighandler", "Caught signal %d\n", sig);
++	purple_core_quit();
+ 
+ 	return TRUE;
+ }
+--- pidgin-2.11.0/pidgin/gtksound.c.orig	2016-11-08 10:49:08.984964482 +0000
++++ pidgin-2.11.0/pidgin/gtksound.c	2016-11-08 10:49:36.381141461 +0000
+@@ -319,9 +319,6 @@
+ 
+ #ifdef USE_GSTREAMER
+ 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+-#ifdef GST_CAN_DISABLE_FORKING
+-	gst_registry_fork_set_enabled (FALSE);
+-#endif
+ 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
+ 		purple_notify_error(NULL, _("GStreamer Failure"),
+ 					_("GStreamer failed to initialize."),