Don't use PCAP_ERROR if it's not known to be defined.

The introduction of pcap_list_datalinks() predates the introduction of
PCAP_ERROR, so the presence of pcap_list_datalinks() doesn't guarantee
that PCAP_ERROR is defined.  Change the use of PCAP_ERROR when checking
the result of pcap_list_datalinks() to just check for -1.

Change-Id: Id8229b7aebd02eaf3701983f9343503397af4fb3
Reviewed-on: https://code.wireshark.org/review/19351
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-12-19 10:54:50 -08:00
parent d7ce60bb08
commit 23d80b0012
1 changed files with 1 additions and 1 deletions

View File

@ -890,7 +890,7 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts,
*/
pcap_close(pch);
if (err_str != NULL) {
if (nlt == PCAP_ERROR)
if (nlt == -1)
*err_str = g_strdup_printf("pcap_list_datalinks() failed: %s",
pcap_geterr(pch));
else