summaryrefslogtreecommitdiff
path: root/lib/libpcap/pcap-bpf.c
diff options
context:
space:
mode:
authordm <dm@cvs.openbsd.org>1997-08-13 20:29:42 +0000
committerdm <dm@cvs.openbsd.org>1997-08-13 20:29:42 +0000
commit467e43fd9f5184a25ed9b8bc7c77d16abdb793ba (patch)
tree2bca60cf62c1834b9e602e2d74436aad0b831963 /lib/libpcap/pcap-bpf.c
parent4ccfea81033f7de6fe05a29c45e81aec673a541b (diff)
Fix PR #299 (pcap_inject busted).
Diffstat (limited to 'lib/libpcap/pcap-bpf.c')
-rw-r--r--lib/libpcap/pcap-bpf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c
index 91234201596..d656a50e94f 100644
--- a/lib/libpcap/pcap-bpf.c
+++ b/lib/libpcap/pcap-bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcap-bpf.c,v 1.7 1996/09/16 02:33:08 tholo Exp $ */
+/* $OpenBSD: pcap-bpf.c,v 1.8 1997/08/13 20:29:41 dm Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996
@@ -149,7 +149,9 @@ bpf_open(pcap_t *p, char *errbuf)
*/
do {
(void)sprintf(device, "/dev/bpf%d", n++);
- fd = open(device, O_RDONLY);
+ fd = open(device, O_RDWR);
+ if (fd < 0 && errno == EACCES)
+ fd = open(device, O_RDONLY);
} while (fd < 0 && errno == EBUSY);
/*