From 7017c7631eafee5b752904064a6d0daec94f32d9 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 12 May 2017 23:43:47 +0000 Subject: Better error message when s6-sudoc gets punted by s6-ipcserver-access --- src/conn-tools/s6-sudoc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/conn-tools/s6-sudoc.c b/src/conn-tools/s6-sudoc.c index eb8f138..18851e0 100644 --- 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 } ; -- cgit v1.2.3