Commit Diff
- Commit:
52b599a63c488d3a80bb9f5dd97bad0b10103c54
- From:
- Russ Cox <rsc@swtch.com>
- Date:
- Message:
- libthread: call setpgrp in programs that will background This fixes the 'run stats from rc; exit rc; stats dies' problem. It's unclear whether this is the right fix or whether rc should be starting all its interactive commands in their own process groups. But at least it does fix stats dying.
- Actions:
- Patch | Tree
--- src/libthread/daemonize.c +++ src/libthread/daemonize.c @@ -101,6 +101,13 @@ _threadsetupdaemonize(void) sigpid = 1; + /* + * We've been told this program is likely to background itself. + * Put it in its own process group so that we don't get a SIGHUP + * when the parent exits. + */ + setpgrp(); + if(pipe(p) < 0) sysfatal("passer pipe: %r");