diff options
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -757,6 +757,8 @@ main(int argc, char *argv[]) gboolean list_link_layer_types = FALSE; gboolean start_capture = FALSE; int status; + GList *if_list; + gchar *err_str; #else gboolean capture_option_specified = FALSE; #endif @@ -1046,8 +1048,23 @@ main(int argc, char *argv[]) #endif case 'D': /* Print a list of capture devices and exit */ #ifdef HAVE_LIBPCAP - status = capture_opts_list_interfaces(FALSE); - exit(status); + if_list = capture_interface_list(&err, &err_str); + if (if_list == NULL) { + switch (err) { + case CANT_GET_INTERFACE_LIST: + 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; + } + exit(2); + } + capture_opts_print_interfaces(if_list); + free_interface_list(if_list); + exit(0); #else capture_option_specified = TRUE; arg_error = TRUE; |