tests/attach-p-cmd-cmd.c: fix potential errno clobbering

* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.
This commit is contained in:
Дмитрий Левин 2016-05-23 16:39:23 +00:00
parent 4ea65fb549
commit 475d2b5da6

View 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;