diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-11-10 12:53:37 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-11-10 12:53:37 +0000 |
commit | 321f8dd75df79a714b17a0f2cd16644ccc4febf9 (patch) | |
tree | 0763334456c8a5b2c2338634773f3b41082c102c /src/supervision/s6-svc.c | |
parent | 5aa544ac273ea5253682b63f9640f9da08073ef3 (diff) | |
download | s6-321f8dd75df79a714b17a0f2cd16644ccc4febf9.tar.xz |
More accurate exit code and clearer error messages for s6-svc and s6-svscanctl
Diffstat (limited to 'src/supervision/s6-svc.c')
-rw-r--r-- | src/supervision/s6-svc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c index 12a351e..d844b20 100644 --- a/src/supervision/s6-svc.c +++ b/src/supervision/s6-svc.c @@ -105,11 +105,11 @@ int main (int argc, char const *const *argv, char const *const *envp) newargv[m++] = 0 ; xpathexec_run(newargv[0], newargv, envp) ; } - else + else switch (s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1)) { - int r = s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1) ; - if (r < 0) strerr_diefu2sys(111, "control ", argv[0]) ; - else if (!r) strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ; + case -1 : strerr_diefu2sys(111, "control ", argv[0]) ; + case -2 : strerr_dief3sys(100, "something is wrong with the ", argv[0], "/" S6_SUPERVISE_CTLDIR " directory. errno reported") ; + case 0 : strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ; } return 0 ; } |