diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-14 13:32:10 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-14 13:32:51 -0400 |
commit | cfa910af9694de0dd218713f66d521ee85c4070c (patch) | |
tree | 9848e19fff3c89f350ff7c02f8bbd4d258182d7f /libjack | |
parent | 59352d43f42d39a69c718fc03f622aae324b325e (diff) | |
download | jack1-cfa910af9694de0dd218713f66d521ee85c4070c.tar.gz |
fix for double-fork still leaving zombies around (from Uli Franke uli.franke@weiss.ch)
Diffstat (limited to 'libjack')
-rw-r--r-- | libjack/client.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libjack/client.c b/libjack/client.c index 52f9ae7..e06617f 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -962,6 +962,9 @@ failure: int start_server (const char *server_name, jack_options_t options) { + int status; + pid_t first_child_pid; + if ((options & JackNoStartServer) || getenv("JACK_NO_START_SERVER")) { return 1; @@ -976,7 +979,10 @@ start_server (const char *server_name, jack_options_t options) * virtual memory tricks, the overhead of the second fork() is * probably relatively small. */ - switch (fork()) { + + first_child_pid = fork(); + + switch (first_child_pid) { case 0: /* child process */ switch (fork()) { case 0: /* grandchild process */ @@ -991,6 +997,9 @@ start_server (const char *server_name, jack_options_t options) return 1; /* failed to start server */ } + /* reap the initaial child */ + waitpid (first_child_pid, &status, 0); + /* only the original parent process goes here */ return 0; /* (probably) successful */ } |