Fix deprecation warning from libcap 1.9.1

This commit is contained in:
William Robinet 2020-08-28 18:24:47 +02:00
parent 73a2c42ee9
commit 68787acabe

View file

@ -283,6 +283,7 @@ int main(argc,argv)
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
#endif #endif
pcap_if_t *interfaces;
char *interface_name=0; char *interface_name=0;
char *file=0; char *file=0;
char *filter=0; char *filter=0;
@ -382,7 +383,11 @@ int main(argc,argv)
if(!file){ if(!file){
if(!interface_name){ if(!interface_name){
interface_name=pcap_lookupdev(errbuf); if(pcap_findalldevs(&interfaces,errbuf)==-1) {
fprintf(stderr,"PCAP: %s\n",errbuf);
err_exit("Aborting",-1);
}
interface_name=interfaces->name;
if(!interface_name){ if(!interface_name){
fprintf(stderr,"PCAP: %s\n",errbuf); fprintf(stderr,"PCAP: %s\n",errbuf);
err_exit("Aborting",-1); err_exit("Aborting",-1);