o Merge rev. 1.5 libexec/ftpd/ftpd.c from DragonflyBSD:

Do not unconditionally fork() after accept().  accept() can
  return -1 due to an interrupted system call (i.e. SIGCHLD).
  If we fork in that case ftpd can get into an
  accept()/SIGCHLD/fork/[fail]/repeat loop.

  Reported-by: fabian <fabian.duelli@bluewin.ch>

Obtained from:	DragonflyBSD
MFC after:	1 month
This commit is contained in:
maxim 2004-09-24 13:21:52 +00:00
parent 227aefb7ee
commit f9d7c3b4cd

View File

@ -503,6 +503,7 @@ main(int argc, char *argv[], char **envp)
fd = accept(ctl_sock[i],
(struct sockaddr *)&his_addr,
&addrlen);
if (fd >= 0) {
if ((pid = fork()) == 0) {
/* child */
(void) dup2(fd, 0);
@ -510,6 +511,7 @@ main(int argc, char *argv[], char **envp)
close(ctl_sock[i]);
} else
close(fd);
}
}
if (pid == 0)
break;