The attached patch seems to have the intended effect; strace's exit status is set to that of the ptraced process, or 1 if strace was signalled. strace -p <pid> still exits with zero status.
only in patch2: unchanged: --- strace-4.5.15.orig/strace.c +++ strace-4.5.15/strace.c @@ -798,10 +798,10 @@ sigaction(SIGCHLD, &sa, NULL); #endif /* USE_PROCFS */ - if (trace() < 0) - exit(1); + int ret=trace(); + if (ret<0) exit(1); cleanup(); - exit(0); + exit(ret); } int @@ -1826,7 +1826,7 @@ pv.events = POLLWANT; if ((what = poll (&pv, 1, 1)) < 0) { if (interrupted) - return 0; + return interrupted; continue; } else if (what == 1 && pv.revents & POLLWANT) { @@ -1837,13 +1837,13 @@ if (poll(pollv, nprocs, INFTIM) < 0) { if (interrupted) - return 0; + return interrupted; continue; } #else /* !HAVE_POLLABLE_PROCFS */ if (proc_poll(pollv, nprocs, INFTIM) < 0) { if (interrupted) - return 0; + return interrupted; continue; } #endif /* !HAVE_POLLABLE_PROCFS */ @@ -1885,7 +1885,7 @@ #endif /* !HAVE_POLLABLE_PROCFS */ } if (interrupted) - return 0; + return interrupted; if (interactive) sigprocmask(SIG_BLOCK, &blocked_set, NULL); @@ -2135,7 +2135,7 @@ sigprocmask(SIG_BLOCK, &blocked_set, NULL); if (interrupted) - return 0; + return interrupted; if (pid == -1) { switch (wait_errno) { @@ -2424,6 +2424,10 @@ return -1; } } + + if (WIFEXITED(status)) return WEXITSTATUS(status); + if (WIFSIGNALED(status)) return WTERMSIG(status); + return 0; } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]