2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Use the double fork trick to avoid the monitor process being waited

for by the main program run through sudo.
This commit is contained in:
Todd C. Miller
2004-12-02 14:53:20 +00:00
parent 68e54d2c8b
commit d88e6523a3

View File

@@ -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. */