From edc865361e20fb0e2c6f7016d083fdcb1b2d355b Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Wed, 10 Apr 2013 01:24:08 +0400 Subject: [PATCH] zdtm: print an error message and exit if exec failed Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/lib/ns.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c index ead4522d9..dd3c6fd5b 100644 --- a/test/zdtm/lib/ns.c +++ b/test/zdtm/lib/ns.c @@ -214,6 +214,8 @@ int ns_init(int argc, char **argv) pid = fork(); if (pid == 0) { execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL); + fprintf(stderr, "Unable to execute ps: %m\n"); + exit(1); } else if (pid > 0) waitpid(pid, NULL, 0); @@ -229,6 +231,8 @@ int ns_init(int argc, char **argv) pid = fork(); if (pid == 0) { execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL); + fprintf(stderr, "Unable to execute ps: %m\n"); + exit(1); } else if (pid > 0) waitpid(pid, NULL, 0);