changeset: 2190:05fe986fcca9
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jul 03 05:34:55 2007 -0400
summary: waidpid() child after double fork hack.
diff -r 42b3effb96d8 -r 05fe986fcca9 cmd/wmii/main.c
--- a/cmd/wmii/main.c Tue Jul 03 05:20:01 2007 -0400
+++ b/cmd/wmii/main.c Tue Jul 03 05:34:55 2007 -0400
@@ -291,13 +291,14 @@ static void
static void
init_traps(void) {
char buf[1];
- int fd[2];
+ pid_t pid;
+ int fd[2], status;
if(pipe(fd) != 0)
fatal("Can't pipe(): %r");
/* Double fork hack */
- switch(fork()) {
+ switch(pid = fork()) {
case -1:
fatal("Can't fork(): %r");
break; /* not reached */
@@ -326,6 +327,7 @@ init_traps(void) {
exit(0);
}
default:
+ waitpid(pid, &status, 0);
break;
}
Received on Tue Jul 03 2007 - 11:39:37 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:32 UTC