diff options
-rw-r--r-- | libexec/ftpd/ftpd.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 9590f78..a5a60a4 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -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; |