ssld: avoid clang static analysis warning
Don't set `x = 0` twice. Edit by @aaronmdjones: fix for loop initialisation and inner condition
This commit is contained in:
parent
a21843a0a0
commit
ae6ce6100a
1 changed files with 8 additions and 4 deletions
12
ssld/ssld.c
12
ssld/ssld.c
|
@ -1189,7 +1189,7 @@ int
|
|||
main(int argc, char **argv)
|
||||
{
|
||||
const char *s_ctlfd, *s_pipe, *s_pid;
|
||||
int ctlfd, pipefd, x, maxfd;
|
||||
int ctlfd, pipefd, maxfd;
|
||||
maxfd = maxconn();
|
||||
|
||||
s_ctlfd = getenv("CTL_FD");
|
||||
|
@ -1209,13 +1209,16 @@ main(int argc, char **argv)
|
|||
ctlfd = atoi(s_ctlfd);
|
||||
pipefd = atoi(s_pipe);
|
||||
ppid = atoi(s_pid);
|
||||
x = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
for(x = 0; x < maxfd; x++)
|
||||
int 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)
|
||||
|
@ -1230,6 +1233,7 @@ main(int argc, char **argv)
|
|||
close(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
setup_signals();
|
||||
rb_lib_init(NULL, NULL, NULL, 0, maxfd, 1024, 4096);
|
||||
rb_init_rawbuffers(1024);
|
||||
|
|
Loading…
Reference in a new issue