From 475d2b5da6dda57abdf10e26d1f3699e6f7c9619 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 23 May 2016 16:39:23 +0000 Subject: [PATCH] tests/attach-p-cmd-cmd.c: fix potential errno clobbering * tests/attach-p-cmd-cmd.c (main): Call getpid before chdir. --- tests/attach-p-cmd-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/attach-p-cmd-cmd.c b/tests/attach-p-cmd-cmd.c index 28f5e359..d2b3ca1f 100644 --- a/tests/attach-p-cmd-cmd.c +++ b/tests/attach-p-cmd-cmd.c @@ -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; -- 2.50.1