From f6ce0cdacd642d31cf198d0bdc4654bbd5afd951 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 22 Jul 2014 16:53:18 -0700 Subject: Get rid of NO_INTERFACES_FOUND - it's not an error. It just means "pcap didn't give me any interfaces, and didn't report an error". Hopefully, in the future, there will be pcap APIs that distinguish between the (admittedly unlikely, these days) case of "there really *are* no interfaces on which *anybody* can capture" and "you don't have sufficient permission to capture", and we can report the latter as an error. (Given that pcap supports more than just "regular interfaces", though, there are cases where you don't have permission to capture on those but you have permission to capture raw USB traffic, for example, so perhaps what's really needed is per-interface indications of permissions.) Change-Id: I7b8abb0829e8502f5259c95e8af31655f79d36a1 Reviewed-on: https://code.wireshark.org/review/3169 Reviewed-by: Guy Harris --- dumpcap.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'dumpcap.c') diff --git a/dumpcap.c b/dumpcap.c index 6975514523..29ec228198 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -1430,16 +1430,11 @@ print_statistics_loop(gboolean machine_readable) if_list = get_interface_list(&err, &err_str); if (if_list == NULL) { - switch (err) { - case CANT_GET_INTERFACE_LIST: - case DONT_HAVE_PCAP: + if (err == 0) + cmdarg_err("There are no interfaces on which a capture can be done"); + else { cmdarg_err("%s", err_str); g_free(err_str); - break; - - case NO_INTERFACES_FOUND: - cmdarg_err("There are no interfaces on which a capture can be done"); - break; } return err; } @@ -4755,15 +4750,7 @@ main(int argc, char *argv[]) if_list = capture_interface_list(&err, &err_str,NULL); if (if_list == NULL) { - switch (err) { - case CANT_GET_INTERFACE_LIST: - case DONT_HAVE_PCAP: - cmdarg_err("%s", err_str); - g_free(err_str); - exit_main(2); - break; - - case NO_INTERFACES_FOUND: + if (err == 0) { /* * If we're being run by another program, just give them * an empty list of interfaces, don't report this as @@ -4774,7 +4761,10 @@ main(int argc, char *argv[]) cmdarg_err("There are no interfaces on which a capture can be done"); exit_main(2); } - break; + } else { + cmdarg_err("%s", err_str); + g_free(err_str); + exit_main(2); } } -- cgit v1.2.3