]> granicus.if.org Git - strace/commitdiff
tests/attach-p-cmd-cmd.c: fix potential errno clobbering
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 23 May 2016 16:39:23 +0000 (16:39 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 23 May 2016 16:39:23 +0000 (16:39 +0000)
* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.

tests/attach-p-cmd-cmd.c

index 28f5e3595c3da870fcc1175ab52587a0939cff80..d2b3ca1f2faf976ff6c8fd94cac5a77799cb711d 100644 (file)
@@ -36,8 +36,8 @@ int
 main(void)
 {
        static const char text[] = "attach-p-cmd.test cmd";
-       assert(chdir(text) == -1);
        pid_t pid = getpid();
+       assert(chdir(text) == -1);
        printf("%-5d chdir(\"%s\") = -1 ENOENT (%m)\n"
               "%-5d +++ exited with 0 +++\n", pid, text, pid);
        return 0;