diff src/aim.c @ 3138:e970fccae757

[gaim-migrate @ 3153] bleh committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 12 Apr 2002 02:30:41 +0000
parents da324fe688b3
children 265a3c9d0557
line wrap: on
line diff
--- a/src/aim.c	Fri Apr 12 02:22:28 2002 +0000
+++ b/src/aim.c	Fri Apr 12 02:30:41 2002 +0000
@@ -554,6 +554,7 @@
 	char *opt_user_arg = NULL, *opt_login_arg = NULL;
 #if HAVE_SIGNAL_H
 	int sig_indx;	/* for setting up signal catching */
+	sigset_t sigset;
 	void (*prev_sig_disp)();
 #endif
 #ifndef USE_APPLET
@@ -603,6 +604,14 @@
 #if HAVE_SIGNAL_H
 	/* Let's not violate any PLA's!!!! */
 	/* jseymour: whatever the fsck that means */
+	/* Robot101: for some reason things like gdm like to block     *
+	 * useful signals like SIGCHLD, so we unblock all the ones we  *
+	 * declare a handler for. thanks JSeymour and Vann.            */
+	if (sigemptyset(&sigset)) {
+		char errmsg[BUFSIZ];
+		sprintf(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) {
 			char errmsg[BUFSIZ];
@@ -610,6 +619,12 @@
 				catch_sig_list[sig_indx]);
 			perror(errmsg);
 		}
+		if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
+			char errmsg[BUFSIZ];
+			sprintf(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) {
@@ -619,6 +634,12 @@
 			perror(errmsg);
 		}
 	}
+
+	if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
+		char errmsg[BUFSIZ];
+		sprintf(errmsg, "Warning: couldn't unblock signals");
+		perror(errmsg);
+	}		
 #endif