When we call pcap_open_live() to check whether we can open a device for
capturing, to decide whether to add it to the list of devices for
pcap_findalldevs(), pass it a separate error string buffer, so that, if
we don't find any devices because we don't have sufficient permissions
to open any of them, we don't set the errbuf argument to
pcap_findalldevs().
pcap_t *p;
pcap_if_t *curdev, *prevdev, *nextdev;
int this_instance;
pcap_t *p;
pcap_if_t *curdev, *prevdev, *nextdev;
int this_instance;
+ char open_errbuf[PCAP_ERRBUF_SIZE];
/*
* Is there already an entry in the list for this interface?
/*
* Is there already an entry in the list for this interface?
}
strcpy(en_name, "en");
strcat(en_name, name + 3);
}
strcpy(en_name, "en");
strcat(en_name, name + 3);
- p = pcap_open_live(en_name, 68, 0, 0, errbuf);
+ p = pcap_open_live(en_name, 68, 0, 0, open_errbuf);
free(en_name);
} else
#endif /* __APPLE */
free(en_name);
} else
#endif /* __APPLE */
- p = pcap_open_live(name, 68, 0, 0, errbuf);
+ p = pcap_open_live(name, 68, 0, 0, open_errbuf);
if (p == NULL) {
/*
* No. Don't bother including it.
if (p == NULL) {
/*
* No. Don't bother including it.