diff --git a/capture/capture_sync.c b/capture/capture_sync.c index d82d8aa6de..4734d0dcd3 100644 --- a/capture/capture_sync.c +++ b/capture/capture_sync.c @@ -21,6 +21,8 @@ #include +#include + #include #include @@ -1602,6 +1604,13 @@ sync_interface_stats_open(int *data_read_fd, ws_process_id *fork_child, char **d * Child process failed unexpectedly, or wait failed; msg is the * error message. */ + } else if (ret == WS_EXIT_NO_INTERFACES) { + /* + * No interfaces were found. If that's not the + * result of an error when fetching the local + * interfaces, let the user know. + */ + *msg = g_strdup(primary_msg_text); } else { /* * Child process failed, but returned the expected exit status. diff --git a/dumpcap.c b/dumpcap.c index e02409e99c..3c85168168 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -16,6 +16,8 @@ #include +#include + #include #ifdef HAVE_NETINET_IN_H @@ -985,8 +987,10 @@ print_statistics_loop(gboolean machine_readable) if_list = get_interface_list(&err, &err_str); if (if_list == NULL) { - if (err == 0) + if (err == 0) { cmdarg_err("There are no interfaces on which a capture can be done"); + err = WS_EXIT_NO_INTERFACES; + } else { cmdarg_err("%s", err_str); g_free(err_str); diff --git a/ui/capture.c b/ui/capture.c index ba2430b61e..a522ea3eff 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -19,6 +19,8 @@ #include +#include + #include #include #include "extcap.h" @@ -986,6 +988,14 @@ capture_interface_stat_start(capture_options *capture_opts _U_, GList **if_list) sc_item->name = g_strdup(if_info->name); sc->cache_list = g_list_prepend(sc->cache_list, sc_item); } + } else if (status == WS_EXIT_NO_INTERFACES) { + /* + * No interfaces were found. If that's not the + * result of an error when fetching the local + * interfaces, let the user know. + */ + ws_info("%s", msg); + g_free(msg); /* XXX: should we display this to the user via the GUI? */ } else { ws_warning("%s", msg); g_free(msg); /* XXX: should we display this to the user via the GUI? */