From: Denys Vlasenko Date: Mon, 8 Jul 2013 11:55:04 +0000 (+0200) Subject: If -o|logger is in use, exit trace loop if nprocs == 0. X-Git-Tag: v4.9~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c41ce287804f5409400c2b87bf11ebc6f6e1091;p=strace If -o|logger is in use, exit trace loop if nprocs == 0. Signed-off-by: Denys Vlasenko --- diff --git a/strace.c b/strace.c index abaa463b..42cfcb99 100644 --- a/strace.c +++ b/strace.c @@ -1973,6 +1973,10 @@ trace(void) * 19923 exit_group(1) = ? * 19923 +++ exited with 1 +++ * Waiting for ECHILD works better. + * (However, if -o|logger is in use, we can't do that. + * Can work around that by double-forking the logger, + * but that loses the ability to wait for its completion on exit. + * Oh well...) */ while (1) { int pid; @@ -1985,6 +1989,9 @@ trace(void) if (interrupted) return; + if (popen_pid != 0 && nprocs == 0) + return; + if (interactive) sigprocmask(SIG_SETMASK, &empty_set, NULL); pid = wait4(-1, &status, __WALL, (cflag ? &ru : NULL)); @@ -2343,7 +2350,7 @@ trace(void) exit_code = 1; return; } - } /* while (nprocs != 0) */ + } /* while (1) */ } int