summaryrefslogtreecommitdiff
path: root/src/supervision
diff options
context:
space:
mode:
Diffstat (limited to 'src/supervision')
-rw-r--r--src/supervision/s6-svc.c8
-rw-r--r--src/supervision/s6-svscanctl.c10
2 files changed, 10 insertions, 8 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 ;
}
diff --git a/src/supervision/s6-svscanctl.c b/src/supervision/s6-svscanctl.c
index 2794290..3339c67 100644
--- a/src/supervision/s6-svscanctl.c
+++ b/src/supervision/s6-svscanctl.c
@@ -13,7 +13,6 @@ int main (int argc, char const *const *argv)
{
char data[DATASIZE] ;
unsigned int datalen = 0 ;
- int r ;
PROG = "s6-svscanctl" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
@@ -51,8 +50,11 @@ int main (int argc, char const *const *argv)
}
if (!argc) dieusage() ;
- r = s6_svc_writectl(argv[0], S6_SVSCAN_CTLDIR, data, datalen) ;
- if (r < 0) strerr_diefu2sys(111, "control ", argv[0]) ;
- else if (!r) strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ;
+ switch (s6_svc_writectl(argv[0], S6_SVSCAN_CTLDIR, data, datalen))
+ {
+ case -1 : strerr_diefu2sys(111, "control ", argv[0]) ;
+ case -2 : strerr_dief3sys(100, "something is wrong with the ", argv[0], "/" S6_SVSCAN_CTLDIR " directory. errno reported") ;
+ case 0 : strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ;
+ }
return 0 ;
}