Ignore errors from pcap_dispatch.
authorEmil Mikulic <emikulic@gmail.com>
Thu, 1 Jan 2009 11:30:37 +0000 (22:30 +1100)
committerEmil Mikulic <emikulic@gmail.com>
Fri, 24 Apr 2009 11:40:23 +0000 (21:40 +1000)
This makes interface going down survivable on Linux.

Prompted by: Chris Franklin

cap.c

diff --git a/cap.c b/cap.c
index b39b1c4..986bed5 100644 (file)
--- a/cap.c
+++ b/cap.c
@@ -244,8 +244,10 @@ cap_poll(fd_set *read_set
             linkhdr->handler, /* callback func from decode.c */
             NULL);            /* user */
 
-      if (ret < 0)
-         errx(1, "pcap_dispatch(): %s", pcap_geterr(pcap));
+      if (ret < 0) {
+         warnx("pcap_dispatch(): %s", pcap_geterr(pcap));
+         return;
+      }
 
       /* Despite count = -1, Linux will only dispatch one packet at a time. */
       total += ret;