]> granicus.if.org Git - strace/commitdiff
Fix printing clone flags
authorWang Chao <wang.chao@cn.fujitsu.com>
Thu, 2 Sep 2010 07:08:59 +0000 (15:08 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 4 Sep 2010 11:05:45 +0000 (11:05 +0000)
When we trace clone() syscall with only exit signal as clone
flags, strace would print an unnecessary OR operator.

* process.c (sys_clone): Fix this.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
process.c

index f7af19681bca514bea6cc7f82f5a6f71cd34e99b..8af960a0ab5f05e533b555d814e178defb8160e2 100644 (file)
--- a/process.c
+++ b/process.c
@@ -618,6 +618,7 @@ sys_clone(tcp)
 struct tcb *tcp;
 {
        if (exiting(tcp)) {
+               const char *sep = "|";
                unsigned long flags = tcp->u_arg[ARG_FLAGS];
                tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
 # ifdef ARG_STACKSIZE
@@ -626,9 +627,10 @@ struct tcb *tcp;
                                tcp->u_arg[ARG_STACKSIZE]);
 # endif
                tprintf("flags=");
-               printflags(clone_flags, flags &~ CSIGNAL, NULL);
+               if (!printflags(clone_flags, flags &~ CSIGNAL, NULL))
+                       sep = "";
                if ((flags & CSIGNAL) != 0)
-                       tprintf("|%s", signame(flags & CSIGNAL));
+                       tprintf("%s%s", sep, signame(flags & CSIGNAL));
                if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
                              |CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
                        return 0;