File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // $Id: bpfmon.c,v 2.48 2020/09/15 15:01:15 bbonev Exp $ {{{
1+ // $Id: bpfmon.c,v 2.49 2020/10/02 19:39:24 bbonev Exp $ {{{
22// Copyright © 2015-2020 Boian Bonev (bbonev@ipacct.com)
33//
44// SPDX-License-Identifer: GPL-2.0-or-later
@@ -113,7 +113,7 @@ static char **drlevels=levels_utf8; // graph draw characters
113113static int heartbeat = 0 ;
114114static char * sbps = " bytes per second " ;
115115static char * spps = " packets per second " ;
116- static char ver []= "$Revision: 2.48 $" ;
116+ static char ver []= "$Revision: 2.49 $" ;
117117static int simplest = 0 ; // use simplest console mode
118118static int legend = 1 ; // show legend in classic mode
119119static int history = 0 ; // show history in classic mode
@@ -988,7 +988,8 @@ int main(int ac,char **av) { // {{{
988988 FD_SET (STDIN_FILENO ,& r );
989989 fdmax = STDIN_FILENO ;
990990 if (source == PCAP ) {
991- FD_SET (pcfd ,& r );
991+ if (pcfd >=0 ) // e.g. on Hurd libpcap does not support events via fd
992+ FD_SET (pcfd ,& r );
992993 fdmax = mymax (fdmax ,pcfd );
993994 }
994995 to .tv_sec = 0 ;
@@ -1149,7 +1150,7 @@ int main(int ac,char **av) { // {{{
11491150 }
11501151 }
11511152 }
1152- if (source == PCAP && FD_ISSET (pcfd ,& r ))
1153+ if (pcfd < 0 || ( source == PCAP && FD_ISSET (pcfd ,& r ) ))
11531154 pcap_dispatch (pc ,10000 ,pc_cb ,NULL );
11541155 }
11551156 if (toexit )
You can’t perform that action at this time.
0 commit comments