--- embedaddon/trafshow/trafshow.c	2012/02/21 16:55:18	1.1
+++ embedaddon/trafshow/trafshow.c	2013/07/22 00:22:30	1.1.1.1.2.1
@@ -20,6 +20,7 @@
 #endif
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/ioctl.h>
 #ifdef	HAVE_PCAP_GET_SELECTABLE_FD
 #include <sys/select.h>
 #endif
@@ -29,6 +30,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
+#include <net/bpf.h>
 #include <pcap.h>
 #include <pthread.h>
 #include <errno.h>
@@ -307,6 +309,7 @@ pcap_init(ph_list, dp)
 	const pcap_addr_t *ap;
 	PCAP_HANDLER *ph, *ph_prev = 0;
 	char *cp, buf[256];
+	int v = 1;
 
 	if (!ph_list) return -1;
 
@@ -334,6 +337,12 @@ pcap_init(ph_list, dp)
 		}
 		if (pcap_setnonblock(pd, 1, buf) < 0) {
 			fprintf(stderr, "%s: %s\n", dp->name, buf);
+			pcap_close(pd);
+			err++;
+			continue;
+		}
+		if (ioctl(pcap_fileno(pd), BIOCIMMEDIATE, &v) < 0) {
+			fprintf(stderr, "%s: %s\n", dp->name, strerror(errno));
 			pcap_close(pd);
 			err++;
 			continue;