The daemon's child shouldn't go on with the for loop

over ctl_sock's -- it is solely the parent daemon's
job.  So just break out of the loop in the child.

MFC after:	5 days
This commit is contained in:
Yaroslav Tykhiy 2006-01-21 12:34:28 +00:00
parent 125b96351a
commit 8eb0508fe1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154631

View File

@ -496,16 +496,17 @@ main(int argc, char *argv[], char **envp)
(struct sockaddr *)&his_addr,
&addrlen);
if (fd >= 0) {
if ((pid = fork()) == 0) {
/* child */
(void) dup2(fd, 0);
(void) dup2(fd, 1);
close(ctl_sock[i]);
} else
if ((pid = fork()) == 0)
break;
else
close(fd);
}
}
if (pid == 0) {
/* child */
(void) dup2(fd, 0);
(void) dup2(fd, 1);
close(ctl_sock[i]);
if (pfh != NULL)
pidfile_close(pfh);
break;