From: Todd C. Miller Date: Thu, 2 Dec 2004 14:53:20 +0000 (+0000) Subject: Use the double fork trick to avoid the monitor process being waited X-Git-Tag: SUDO_1_7_0~776 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d88e6523a38dc9300c5248d094f64ae84f4ac289;p=sudo Use the double fork trick to avoid the monitor process being waited for by the main program run through sudo. --- diff --git a/mon_systrace.c b/mon_systrace.c index 94bd2a453..21dce6b4f 100644 --- a/mon_systrace.c +++ b/mon_systrace.c @@ -125,7 +125,18 @@ systrace_attach(pid) case -1: error(1, "can't fork"); case 0: - /* tracer */ + /* tracer, fork again to completely disassociate */ + switch (fork()) { + case -1: + warning("can't fork"); + kill(pid, SIGKILL); + _exit(1); + case 0: + break; + default: + /* the main sudo process will wait for us */ + _exit(0); + } break; default: /* tracee, sleep until the tracer process wakes us up. */