]> granicus.if.org Git - strace/commitdiff
clone: fix printing of zero clone flags
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Jun 2019 09:49:27 +0000 (09:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Jun 2019 09:49:27 +0000 (09:49 +0000)
* clone.c (SYS_FUNC(clone)): Fix printing of zero clone flags.
* tests/clone-flags.c (main): Check it.

clone.c
tests/clone-flags.c

diff --git a/clone.c b/clone.c
index 383b8a7465abe370e30de757de6edb463b99e020..f43431ae67e2a8b8e375da2cde3db092e9c9395c 100644 (file)
--- a/clone.c
+++ b/clone.c
@@ -91,12 +91,17 @@ SYS_FUNC(clone)
                                tcp->u_arg[ARG_STACKSIZE]);
 #endif
                tprints("flags=");
-               const char *sep = "|";
-               if (!printflags64(clone_flags, flags, NULL))
-                       sep = "";
-               if (sig != 0) {
-                       tprints(sep);
-                       printsignal(sig);
+               if (flags) {
+                       printflags64(clone_flags, flags, "CLONE_???");
+                       if (sig) {
+                               tprints("|");
+                               printsignal(sig);
+                       }
+               } else {
+                       if (sig)
+                               printsignal(sig);
+                       else
+                               tprints("0");
                }
                /*
                 * TODO on syscall entry:
index dbcf71df778cf97ddbfd6a16ca074a08bc034849..49cdbb49943913e7bedddcbd1df23f252d0c2768 100644 (file)
@@ -95,6 +95,11 @@ main(void)
                (unsigned long) child_stack +
                (child_stack_reported - child_stack_expected);
 
+       pid = do_clone(child, child_stack, child_stack_size, 0, 0);
+       printf("%s(child_stack=%#lx" STACK_SIZE_FMT ", flags=%s) = %d\n",
+              SYSCALL_NAME, child_stack_printed, STACK_SIZE_ARG
+              "0", pid);
+
        pid = do_clone(child, child_stack, child_stack_size, CLONE_FS, 0);
        printf("%s(child_stack=%#lx" STACK_SIZE_FMT ", flags=%s) = %d\n",
               SYSCALL_NAME, child_stack_printed, STACK_SIZE_ARG