changeset 28863:6e06fbee9244

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.
author Jun Wu <quark@fb.com>
date Sun, 10 Apr 2016 22:00:34 +0100
parents 39130afcce60
children b0811a9fe67c
files contrib/chg/chg.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)) {