Changed the display of the contents of the error message buffer to only do so if no devices were returned at all
This commit is contained in:
parent
f66175beea
commit
ffa52ab3fd
1 changed files with 7 additions and 5 deletions
12
sim_ether.c
12
sim_ether.c
|
@ -3167,11 +3167,6 @@ if (pcap_findalldevs(&alldevs, errbuf) == -1) {
|
|||
if (sim_log) fprintf (sim_log, msg, errbuf);
|
||||
}
|
||||
else {
|
||||
if (errbuf[0]) {
|
||||
char* msg = "Eth: pcap_findalldevs warning: %s\r\n";
|
||||
printf (msg, errbuf);
|
||||
if (sim_log) fprintf (sim_log, msg, errbuf);
|
||||
}
|
||||
/* copy device list into the passed structure */
|
||||
for (i=0, dev=alldevs; dev && (i < max); dev=dev->next, ++i) {
|
||||
if ((dev->flags & PCAP_IF_LOOPBACK) || (!strcmp("any", dev->name))) continue;
|
||||
|
@ -3190,6 +3185,13 @@ else {
|
|||
/* Add any host specific devices and/or validate those already found */
|
||||
i = eth_host_devices(i, max, list);
|
||||
|
||||
/* If no devices were found and an error message was left in the buffer, display it */
|
||||
if ((i == 0) && (errbuf[0])) {
|
||||
char* msg = "Eth: pcap_findalldevs warning: %s\r\n";
|
||||
printf (msg, errbuf);
|
||||
if (sim_log) fprintf (sim_log, msg, errbuf);
|
||||
}
|
||||
|
||||
/* return device count */
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue