changeset: 1729:7aa8e0f939ce
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Feb 04 13:31:12 2007 -0500
files: main.c
description:
Added SIGCHLD handler
diff -r 0a40690e62b8 -r 7aa8e0f939ce main.c
--- a/main.c Sat Feb 03 14:38:31 2007 -0500
+++ b/main.c Sun Feb 04 13:31:12 2007 -0500
@@ -6,6 +6,7 @@
#include <fcntl.h>
#include <locale.h>
#include <pwd.h>
+#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@@ -26,6 +27,13 @@ usage() {
usage() {
fputs("usage: wmiiwm -a <address> [-r <wmiirc>] [-v]\n", stderr);
exit(1);
+}
+
+static void
+sigchld_handler(int sig) {
+ int ret;
+ /* We only spawn one child */
+ wait(&ret);
}
static void
@@ -265,6 +273,7 @@ main(int argc, char *argv[]) {
if(wmiirc) {
int name_len = strlen(wmiirc) + 6;
char execstr[name_len];
+ signal(SIGCHLD, sigchld_handler);
switch(fork()) {
case 0:
if(setsid() == -1)
Received on Sun Feb 04 2007 - 19:40:04 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:52 UTC