diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-15 17:51:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-15 17:51:15 +0000 |
commit | 5a78a14c796309c145b8ea80b0165020bdef34a2 (patch) | |
tree | 2e112123736bd851faf0fcd51dd4516f2464007e /usr.sbin | |
parent | 005209f9d483f60cddc25c0f0e36808149b8e4cc (diff) |
close fd leak; jeff@FORYS.CRANBURY.NJ.US
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/inetd/inetd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index ac42a79c173..e688126cf6a 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inetd.c,v 1.48 1998/07/13 02:11:48 millert Exp $ */ +/* $OpenBSD: inetd.c,v 1.49 1998/07/15 17:51:14 deraadt Exp $ */ /* $NetBSD: inetd.c,v 1.11 1996/02/22 11:14:41 mycroft Exp $ */ /* * Copyright (c) 1983,1991 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/ -static char rcsid[] = "$OpenBSD: inetd.c,v 1.48 1998/07/13 02:11:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: inetd.c,v 1.49 1998/07/15 17:51:14 deraadt Exp $"; #endif /* not lint */ /* @@ -412,7 +412,7 @@ main(argc, argv, envp) } for (;;) { - int n, ctrl; + int n, ctrl = -1; fd_set readable; if (nsock == 0) { @@ -496,6 +496,9 @@ main(argc, argv, envp) syslog(LOG_ERR, "%s/%s server failing (looping), service terminated", sep->se_service, sep->se_proto); + if (!sep->se_wait && + sep->se_socktype == SOCK_STREAM) + close(ctrl); FD_CLR(sep->se_fd, &allsock); (void) close(sep->se_fd); sep->se_fd = -1; |