commit 7017c7631eafee5b752904064a6d0daec94f32d9
parent 9c5a0cad586dc18e33d6af69755d2f760e3dadc4
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Fri, 12 May 2017 23:43:47 +0000
Better error message when s6-sudoc gets punted by s6-ipcserver-access
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/conn-tools/s6-sudoc.c b/src/conn-tools/s6-sudoc.c
@@ -56,11 +56,15 @@ int main (int argc, char const *const *argv, char const *const *envp)
tain_now_g() ;
tain_add_g(&deadline, &deadline) ;
{
+ size_t r ;
char tmp[S6_SUDO_BANNERB_LEN] ;
- if (buffer_timed_get_g(&b6, tmp, S6_SUDO_BANNERB_LEN, &deadline) < S6_SUDO_BANNERB_LEN)
+ r = buffer_timed_get_g(&b6, tmp, S6_SUDO_BANNERB_LEN, &deadline) ;
+ if (!r)
+ strerr_dief1x(111, "connect to the s6-sudod server - check that you have appropriate permissions") ;
+ if (r < S6_SUDO_BANNERB_LEN)
strerr_diefu1sys(111, "read banner from s6-sudod") ;
if (strncmp(tmp, S6_SUDO_BANNERB, S6_SUDO_BANNERB_LEN))
- strerr_dief1x(100, "wrong server banner") ;
+ strerr_dief1x(100, "wrong banner - check that you are connecting to a s6-sudod server") ;
}
{
int fds[3] = { 0, 1, 2 } ;