Correctly handle errors other than problems reading /sys/class/net.
This commit is contained in:
parent
1eb25ea82a
commit
a9a939af2a
15
pcap-linux.c
15
pcap-linux.c
|
@ -1891,14 +1891,17 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf)
|
||||||
break;
|
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,
|
if (errno != 0) {
|
||||||
"Error reading /sys/class/net: %s",
|
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||||
pcap_strerror(errno));
|
"Error reading /sys/class/net: %s",
|
||||||
ret = -1;
|
pcap_strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)close(fd);
|
(void)close(fd);
|
||||||
|
|
Reference in New Issue