mirror of
https://github.com/mfontanini/libtins
synced 2026-01-27 20:24:26 +01:00
Simplified error string generation on Sniffer::pcap_open_live_extended.
This commit is contained in:
@@ -211,17 +211,7 @@ pcap_open_live_extended(const char *source, int snaplen, int promisc, int to_ms,
|
||||
return (p);
|
||||
|
||||
fail:
|
||||
if (status == PCAP_ERROR)
|
||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", source,
|
||||
pcap_geterr(p));
|
||||
else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
|
||||
status == PCAP_ERROR_PERM_DENIED ||
|
||||
status == PCAP_ERROR_PROMISC_PERM_DENIED)
|
||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)", source,
|
||||
pcap_statustostr(status), pcap_geterr(p));
|
||||
else
|
||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", source,
|
||||
pcap_statustostr(status));
|
||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", source, pcap_geterr(p));
|
||||
pcap_close(p);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user