summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravsm <avsm@openbsd.org>2004-04-03 10:21:18 +0000
committeravsm <avsm@openbsd.org>2004-04-03 10:21:18 +0000
commiteba28e5d30fad754a52e980a8f196b87dfdba1c5 (patch)
tree6a5c09d5c5446ef3af6f570fa9871c0958ea2f7b
parent- dont send junk err in parent_open_dump() if filename is NULL (diff)
downloadwireguard-openbsd-eba28e5d30fad754a52e980a8f196b87dfdba1c5.tar.xz
wireguard-openbsd-eba28e5d30fad754a52e980a8f196b87dfdba1c5.zip
dont close an invalid fd, canacar@ ok
-rw-r--r--sbin/pflogd/privsep.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/pflogd/privsep.c b/sbin/pflogd/privsep.c
index 50807ada4e4..842c8a40a50 100644
--- a/sbin/pflogd/privsep.c
+++ b/sbin/pflogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.8 2004/03/14 19:17:05 otto Exp $ */
+/* $OpenBSD: privsep.c,v 1.9 2004/04/03 10:21:18 avsm Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -147,12 +147,13 @@ priv_init(void)
fd = open(filename,
O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK|O_NOFOLLOW,
0600);
+ send_fd(socks[0], fd);
if (fd < 0)
logmsg(LOG_NOTICE,
"[priv]: failed to open %s: %s",
filename, strerror(errno));
- send_fd(socks[0], fd);
- close(fd);
+ else
+ close(fd);
break;
default: