summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient/bpf.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2014-11-08 22:08:01 +0000
committerkrw <krw@openbsd.org>2014-11-08 22:08:01 +0000
commite5e99e47d707742c465d09a01d22f844e6777dcb (patch)
treeba0364bc6c7c381f4cdb7160870df825d7c07f34 /sbin/dhclient/bpf.c
parentDelete commented out 'romtty' device configuration. (diff)
downloadwireguard-openbsd-e5e99e47d707742c465d09a01d22f844e6777dcb.tar.xz
wireguard-openbsd-e5e99e47d707742c465d09a01d22f844e6777dcb.zip
Use open(O_CLOEXEC) rather than open() + fcntl(FD_CLOEXEC). Inspired
by and ok guenther@.
Diffstat (limited to 'sbin/dhclient/bpf.c')
-rw-r--r--sbin/dhclient/bpf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index 3cc033680a0..6ffdfd369dd 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.34 2014/11/08 19:30:30 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.35 2014/11/08 22:08:01 krw Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -66,7 +66,7 @@ if_register_bpf(void)
/* Open a BPF device */
for (b = 0; 1; b++) {
snprintf(filename, sizeof(filename), BPF_FORMAT, b);
- sock = open(filename, O_RDWR, 0);
+ sock = open(filename, O_RDWR | O_CLOEXEC, 0);
if (sock < 0) {
if (errno == EBUSY)
continue;
@@ -195,7 +195,6 @@ if_register_receive(void)
/* Open a BPF device and hang it on this interface. */
ifi->rfdesc = if_register_bpf();
- fcntl(ifi->rfdesc, F_SETFD, FD_CLOEXEC);
/* Make sure the BPF version is in range. */
if (ioctl(ifi->rfdesc, BIOCVERSION, &v) < 0)