chg: server exited with code 0 without being connectable is an error
authorJun Wu <quark@fb.com>
Sun, 10 Apr 2016 22:00:34 +0100
changeset 28863 6e06fbee9244
parent 28862 39130afcce60
child 28864 b0811a9fe67c
chg: server exited with code 0 without being connectable is an error Before this patch, if the server started by chg has exited with code 0 without creating a connectable unix domain socket at the specified address, chg will exit with code 0, which is not the correct behavior. It can happen, for example, CHGHG is set to /bin/true. This patch addresses the issue by checking the exit code of the server and printing a new error message if the server exited normally but cannot be reached.
contrib/chg/chg.c
--- a/contrib/chg/chg.c	Fri Apr 08 23:33:28 2016 -0700
+++ b/contrib/chg/chg.c	Sun Apr 10 22:00:34 2016 +0100
@@ -269,6 +269,9 @@
 
 cleanup:
 	if (WIFEXITED(pst)) {
+		if (WEXITSTATUS(pst) == 0)
+			abortmsg("could not connect to cmdserver "
+				 "(exited with status 0)");
 		debugmsg("cmdserver exited with status %d", WEXITSTATUS(pst));
 		exit(WEXITSTATUS(pst));
 	} else if (WIFSIGNALED(pst)) {