From e5dd06303f15ec5610bbe6812c896628c9e55c07 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 14 May 2019 00:35:02 +0000 Subject: Different code style for the maxconn spurious warning avoidance --- src/conn-tools/s6-tcpserver4d.c | 8 +++----- src/conn-tools/s6-tcpserver6d.c | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/conn-tools/s6-tcpserver4d.c b/src/conn-tools/s6-tcpserver4d.c index 3432236..7f8f27a 100644 --- a/src/conn-tools/s6-tcpserver4d.c +++ b/src/conn-tools/s6-tcpserver4d.c @@ -355,12 +355,10 @@ int main (int argc, char const *const *argv, char const *const *envp) pidip = pidip_inyostack ; ipnum = ipnum_inyostack ; while (cont) { - int h = numconn < maxconn ; - if (iopause_g(x, 1 + h, 0) < 0) strerr_diefu1sys(111, "iopause") ; - + if (iopause_g(x, 1 + (numconn < maxconn), 0) < 0) strerr_diefu1sys(111, "iopause") ; if (x[0].revents & IOPAUSE_EXCEPT) strerr_dief1x(111, "trouble with selfpipe") ; - if (x[0].revents & IOPAUSE_READ) handle_signals() ; - if (h) + if (x[0].revents & IOPAUSE_READ) { handle_signals() ; continue ; } + if (numconn < maxconn) { if (x[1].revents & IOPAUSE_EXCEPT) strerr_dief1x(111, "trouble with socket") ; if (x[1].revents & IOPAUSE_READ) diff --git a/src/conn-tools/s6-tcpserver6d.c b/src/conn-tools/s6-tcpserver6d.c index 8000531..65e9133 100644 --- a/src/conn-tools/s6-tcpserver6d.c +++ b/src/conn-tools/s6-tcpserver6d.c @@ -360,13 +360,12 @@ int main (int argc, char const *const *argv, char const *const *envp) while (cont) { - int h = numconn < maxconn ; - if (iopause_g(x, 1 + h, 0) < 0) + if (iopause_g(x, 1 + (numconn < maxconn), 0) < 0) strerr_diefu1sys(111, "iopause") ; if (x[0].revents & IOPAUSE_EXCEPT) strerr_dief1x(111, "trouble with selfpipe") ; - if (x[0].revents & IOPAUSE_READ) handle_signals() ; - if (h) + if (x[0].revents & IOPAUSE_READ) { handle_signals() ; continue ; } + if (numconn < maxconn) { if (x[1].revents & IOPAUSE_EXCEPT) strerr_dief1x(111, "trouble with socket") ; if (x[1].revents & IOPAUSE_READ) -- cgit v1.2.3