]> jfr.im git - irc/charybdis-ircd/charybdis.git/commitdiff
ssld: avoid clang static analysis warning
authorSimon Arlott <sa.me.uk>
Sat, 29 Jul 2017 19:29:24 +0000 (20:29 +0100)
committerSimon Arlott <sa.me.uk>
Fri, 4 Aug 2017 19:51:53 +0000 (20:51 +0100)
Edit by @aaronmdjones: fix for loop initialisation and inner condition

ssld/ssld.c

index 6584b7e3c1905f570af24d9e50e57c0ae7e9e213..db33486be448d2421288b5aa2a35b762ed91f9c1 100644 (file)
@@ -1181,11 +1181,13 @@ main(int argc, char **argv)
 
 #ifndef _WIN32
        int x;
-       for(x = 0; x < maxfd; x++)
+
+       for(x = 3; x < maxfd; x++)
        {
-               if(x != ctlfd && x != pipefd && x > 2)
+               if(x != ctlfd && x != pipefd)
                        close(x);
        }
+
        x = open("/dev/null", O_RDWR);
 
        if(x >= 0)