capture: silence warning for non-root user
This commit is contained in:
parent
d0bb6b3dfe
commit
4bb69a479d
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <signal.h>
|
||||
|
||||
#include <ws_exit_codes.h>
|
||||
|
||||
#include <wsutil/strtoi.h>
|
||||
#include <wsutil/ws_assert.h>
|
||||
|
||||
|
@ -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.
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <ws_exit_codes.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#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);
|
||||
|
|
10
ui/capture.c
10
ui/capture.c
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include <ws_exit_codes.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/dfilter/dfilter.h>
|
||||
#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? */
|
||||
|
|
Loading…
Reference in New Issue