]> granicus.if.org Git - strace/commitdiff
Test PTRACE_O_TRACECLONE and PTRACE_O_TRACEVFORK along with PTRACE_O_TRACEFORK
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 13 Jan 2011 14:49:39 +0000 (14:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 13 Jan 2011 14:49:39 +0000 (14:49 +0000)
* strace.c (test_ptrace_setoptions): Add PTRACE_O_TRACECLONE and
PTRACE_O_TRACEVFORK to PTRACE_SETOPTIONS call, to test exactly
the same set of options that is going to be used later in trace().

strace.c

index e1ae8f1783a1d9cf82fe918fe3ae5c0893177f18..6b0ebacf79e75b3866caf351e83af5ba92478a64 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -726,13 +726,14 @@ test_ptrace_setoptions(void)
                                kill(tracee_pid, SIGKILL);
                }
                else if (WIFSTOPPED(status)) {
+                       const unsigned int test_options = PTRACE_O_TRACECLONE |
+                                                         PTRACE_O_TRACEFORK |
+                                                         PTRACE_O_TRACEVFORK;
                        if (status >> 16 == PTRACE_EVENT_FORK)
-                               ptrace_setoptions |= (PTRACE_O_TRACEVFORK |
-                                                     PTRACE_O_TRACECLONE |
-                                                     PTRACE_O_TRACEFORK);
+                               ptrace_setoptions |= test_options;
                        if (WSTOPSIG(status) == SIGSTOP) {
                                if (ptrace(PTRACE_SETOPTIONS, pid, NULL,
-                                          PTRACE_O_TRACEFORK) < 0) {
+                                          test_options) < 0) {
                                        kill(pid, SIGKILL);
                                        return -1;
                                }