diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2004-04-08 12:38:01 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2004-04-08 12:38:01 +0000 |
commit | 67bfc05a88ea11cdbc5ba44db7442ae468f04e08 (patch) | |
tree | dc5da25efb525e35a5fbf4f03d304183eb8cd6c8 /usr.sbin | |
parent | 9c318af55dd2124071f073bdde8c8919965a1b86 (diff) |
only close fd if its valid, from Moritz Jodeit <moritz at jodeit.org>
canacar@ ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/tcpdump/privsep_pcap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c index 58f396b5032..e4edb473b40 100644 --- a/usr.sbin/tcpdump/privsep_pcap.c +++ b/usr.sbin/tcpdump/privsep_pcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_pcap.c,v 1.2 2004/02/05 22:12:06 otto Exp $ */ +/* $OpenBSD: privsep_pcap.c,v 1.3 2004/04/08 12:38:00 avsm Exp $ */ /* * Copyright (c) 2004 Can Erkin Acar @@ -323,7 +323,8 @@ priv_pcap_live(const char *dev, int slen, int prom, int to_ms, char *ebuf) return (p); bad: - close(fd); + if (fd >= 0) + close(fd); free(p); return (NULL); } |