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

* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.
diff --git a/tests/attach-p-cmd-cmd.c b/tests/attach-p-cmd-cmd.c
index 28f5e35..d2b3ca1 100644
--- a/tests/attach-p-cmd-cmd.c
+++ b/tests/attach-p-cmd-cmd.c
@@ -36,8 +36,8 @@
 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;