# HG changeset patch
# User Sean Egan <seanegan@gmail.com>
# Date 1035659786 0
# Node ID b7a6aa99ee7c40d6bfc8df50c9f0912d5fd1883b
# Parent  3c0bbaec90ed275e8ed35dad39e579397729ba5e
[gaim-migrate @ 3949]
Damned sound.  Thanks, Rob McQueen.

committer: Tailor Script <tailor@pidgin.im>

diff -r 3c0bbaec90ed -r b7a6aa99ee7c src/aim.c
--- a/src/aim.c	Sat Oct 26 18:12:17 2002 +0000
+++ b/src/aim.c	Sat Oct 26 19:16:26 2002 +0000
@@ -395,6 +395,12 @@
 #endif
 		abort();
 		break;
+	case SIGCHLD:
+		clean_pid();
+#if HAVE_SIGNAL_H
+		signal(SIGCHLD, sighandler);    /* restore signal catching on this one! */
+#endif
+		break;
 	default:
 		debug_printf("caught signal %d\n", sig);
 		signoff_all(NULL, NULL);
diff -r 3c0bbaec90ed -r b7a6aa99ee7c src/gaim.h
--- a/src/gaim.h	Sat Oct 26 18:12:17 2002 +0000
+++ b/src/gaim.h	Sat Oct 26 19:16:26 2002 +0000
@@ -445,6 +445,7 @@
 extern char *normalize(const char *);
 extern char *tobase64(const char *);
 extern void frombase64(const char *, char **, int *);
+extern void clean_pid();
 extern char *date();
 extern gint linkify_text(char *);
 extern FILE *open_log_file (char *, int);
diff -r 3c0bbaec90ed -r b7a6aa99ee7c src/util.c
--- a/src/util.c	Sat Oct 26 18:12:17 2002 +0000
+++ b/src/util.c	Sat Oct 26 19:16:26 2002 +0000
@@ -642,6 +642,21 @@
 	return date;
 }
 
+void clean_pid(void)
+{
+#ifndef _WIN32
+	int status;
+	pid_t pid;
+
+	pid = waitpid(-1, &status, 0);
+	if(pid < 0 && errno != ECHILD) {
+		char errmsg[BUFSIZ];
+		sprintf(errmsg, "Warning: waitpid() returned %d", pid);
+		perror(errmsg);
+	}
+#endif
+}
+
 struct aim_user *find_user(const char *name, int protocol)
 {
 	char *who = g_strdup(normalize(name));