summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-09-30 20:33:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-09-30 20:33:53 +0000
commit7289089b257290f8bade080bc5eeb4947d0628c4 (patch)
tree5f2162bc6871af141d31def73c47e274f6ff43fc /libexec
parentbd878303c98b48eb4f20b3087c862e657933f816 (diff)
cope nicer with accept() failures, from freebsd; millert ok
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 685b5651c76..6cffa5dceed 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.153 2003/12/12 19:45:22 deraadt Exp $ */
+/* $OpenBSD: ftpd.c,v 1.154 2004/09/30 20:33:52 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -70,7 +70,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
static const char rcsid[] =
- "$OpenBSD: ftpd.c,v 1.153 2003/12/12 19:45:22 deraadt Exp $";
+ "$OpenBSD: ftpd.c,v 1.154 2004/09/30 20:33:52 deraadt Exp $";
#endif
#endif /* not lint */
@@ -481,9 +481,11 @@ main(int argc, char *argv[])
fd = accept(pfds[i].fd,
(struct sockaddr *)&his_addr,
&addrlen);
- if (fork() == 0)
- goto child;
- close(fd);
+ if (fd != -1) {
+ if (fork() == 0)
+ goto child;
+ close(fd);
+ }
}
}