[CRIU] [PATCH] zdtm: add a bit more messages in error cases

Andrey Vagin avagin at openvz.org
Sat Feb 1 12:12:45 PST 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/lib/ns.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index eca3736..fb6d70e 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -214,9 +214,11 @@ int ns_init(int argc, char **argv)
 		fprintf(stderr, "exec(%s) failed: %m\n", argv[0]);
 		return ret;
 	}
-	ret = 1;
-	waitpid(pid, &ret, 0);
-	if (ret)
+
+	ret = -1;
+	if (waitpid(pid, &ret, 0) < 0)
+		fprintf(stderr, "waitpid() failed: %m\n");
+	else if (ret)
 		fprintf(stderr, "The test returned non-zero code %d\n", ret);
 
 	pid = fork();
@@ -305,8 +307,10 @@ void ns_create(int argc, char **argv)
 	}
 
 	pidfile = getenv("ZDTM_PIDFILE");
-	if (pidfile == NULL)
+	if (pidfile == NULL) {
+		fprintf(stderr, "ZDTM_PIDFILE isn't defined");
 		exit(1);
+	}
 	fd = open(pidfile, O_CREAT | O_EXCL | O_WRONLY, 0666);
 	if (fd == -1) {
 		fprintf(stderr, "Can't create the file %s: %m\n", pidfile);
-- 
1.8.5.3



More information about the CRIU mailing list