diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2010-12-07 12:50:49 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2010-12-07 12:50:49 +0000 |
commit | 8044bc1463f62ae5f974cc531576bc18dade0337 (patch) | |
tree | 67b0ad6de293c9b9688afa77227bcb461d431dcb | |
parent | bdafa1a90569fb791af6abdffca109fee044d94e (diff) | |
download | strace-8044bc1463f62ae5f974cc531576bc18dade0337.tar.gz |
Fix strace -f -o '|command' hangup
* strace.c (main): Call test_ptrace_setoptions() before parsing
-o option, otherwise a forked command will cause a hangup inside
test_ptrace_setoptions().
-rw-r--r-- | strace.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -945,6 +945,20 @@ main(int argc, char *argv[]) run_gid = getgid(); } +#ifdef LINUX + if (followfork) { + if (test_ptrace_setoptions() < 0) { + fprintf(stderr, + "Test for options supported by PTRACE_SETOPTIONS " + "failed, giving up using this feature.\n"); + ptrace_setoptions = 0; + } + if (debug) + fprintf(stderr, "ptrace_setoptions = %#x\n", + ptrace_setoptions); + } +#endif + /* Check if they want to redirect the output. */ if (outfname) { /* See if they want to pipe the output. */ @@ -975,20 +989,6 @@ main(int argc, char *argv[]) qflag = 1; } -#ifdef LINUX - if (followfork) { - if (test_ptrace_setoptions() < 0) { - fprintf(stderr, - "Test for options supported by PTRACE_SETOPTIONS " - "failed, giving up using this feature.\n"); - ptrace_setoptions = 0; - } - if (debug) - fprintf(stderr, "ptrace_setoptions = %#x\n", - ptrace_setoptions); - } -#endif - /* Valid states here: optind < argc pflag_seen outfname interactive 1 0 0 1 |