about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-11-03 23:18:03 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-11-03 23:18:03 +0100
commit36f3dd812116850393db3fc225f8dde50512cb6e (patch)
tree5ff47da901dfb7692f34b0185310cd1902ecfed2
parentb4a3e45856da6f4755943c190c712ce7fcf92dc0 (diff)
downloadxe-36f3dd812116850393db3fc225f8dde50512cb6e.tar.gz
xe-36f3dd812116850393db3fc225f8dde50512cb6e.tar.xz
xe-36f3dd812116850393db3fc225f8dde50512cb6e.zip
run: print error message when fork(2) failed
-rw-r--r--xe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xe.c b/xe.c
index 30231eb..3e0bc35 100644
--- a/xe.c
+++ b/xe.c
@@ -271,9 +271,10 @@ run()
 		int status = (errno == ENOENT ? 127 : 126);
 		fprintf(stderr, "xe: %s: %s\n", args[0], strerror(errno));
 		exit(status);
-	}
-	if (pid < 0)
+	} else if (pid < 0) {  // fork failed
+		fprintf(stderr, "xe: %s: %s\n", args[0], strerror(errno));
 		exit(126);
+	}
 
 	if (Lflag) {
 		long iter = iterations;