From d88e6523a38dc9300c5248d094f64ae84f4ac289 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 2 Dec 2004 14:53:20 +0000 Subject: [PATCH] Use the double fork trick to avoid the monitor process being waited for by the main program run through sudo. --- mon_systrace.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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. */ -- 2.40.0