dect
/
libpcap
Archived
13
0
Fork 0

Correctly handle errors other than problems reading /sys/class/net.

This commit is contained in:
Guy Harris 2010-01-10 11:01:56 -08:00
parent 1eb25ea82a
commit a9a939af2a
1 changed files with 9 additions and 6 deletions

View File

@ -1891,14 +1891,17 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf)
break;
}
}
if (errno != 0) {
if (ret != -1) {
/*
* Error reading the directory.
* Well, we didn't fail for any other reason; did we
* fail due to an error reading the directory?
*/
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"Error reading /sys/class/net: %s",
pcap_strerror(errno));
ret = -1;
if (errno != 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"Error reading /sys/class/net: %s",
pcap_strerror(errno));
ret = -1;
}
}
(void)close(fd);