aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capchild/capture_ifinfo.c5
-rw-r--r--capture_opts.c12
-rw-r--r--caputils/capture-pcap-util-unix.c2
-rw-r--r--caputils/capture-pcap-util.c4
-rw-r--r--caputils/capture-wpcap.c2
-rw-r--r--caputils/capture_ifinfo.h3
-rw-r--r--dumpcap.c26
-rw-r--r--tshark.c11
-rw-r--r--ui/gtk/main.c15
-rw-r--r--ui/gtk/main_welcome.c16
-rw-r--r--ui/gtk/prefs_capture.c2
-rw-r--r--ui/qt/main.cpp15
12 files changed, 40 insertions, 73 deletions
diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c
index 94af1c0274..54e4d4c4fc 100644
--- a/capchild/capture_ifinfo.c
+++ b/capchild/capture_ifinfo.c
@@ -116,6 +116,8 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List ...");
+ *err = 0;
+
/* Try to get our interface list */
ret = sync_interface_list_open(&data, &primary_msg, &secondary_msg, update_cb);
if (ret != 0) {
@@ -188,9 +190,6 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
}
g_strfreev(raw_list);
- /* Check to see if we built a list */
- if (if_list == NULL)
- *err = NO_INTERFACES_FOUND;
#ifdef HAVE_PCAP_REMOTE
if (remote_interface_list && g_list_length(remote_interface_list) > 0) {
append_remote_list(if_list);
diff --git a/capture_opts.c b/capture_opts.c
index 7b92f74760..313471f1b9 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -457,17 +457,11 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
}
if_list = capture_interface_list(&err, &err_str, NULL);
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 2;
}
diff --git a/caputils/capture-pcap-util-unix.c b/caputils/capture-pcap-util-unix.c
index 21e832b166..66404500ce 100644
--- a/caputils/capture-pcap-util-unix.c
+++ b/caputils/capture-pcap-util-unix.c
@@ -308,7 +308,7 @@ get_interface_list(int *err, char **err_str)
/*
* No interfaces found.
*/
- *err = NO_INTERFACES_FOUND;
+ *err = 0;
if (err_str != NULL)
*err_str = NULL;
}
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c
index c4e7df3868..98054c4a0f 100644
--- a/caputils/capture-pcap-util.c
+++ b/caputils/capture-pcap-util.c
@@ -437,7 +437,7 @@ get_interface_list_findalldevs_ex(const char *source,
/*
* No interfaces found.
*/
- *err = NO_INTERFACES_FOUND;
+ *err = 0;
if (err_str != NULL)
*err_str = NULL;
return NULL;
@@ -474,7 +474,7 @@ get_interface_list_findalldevs(int *err, char **err_str)
/*
* No interfaces found.
*/
- *err = NO_INTERFACES_FOUND;
+ *err = 0;
if (err_str != NULL)
*err_str = NULL;
return NULL;
diff --git a/caputils/capture-wpcap.c b/caputils/capture-wpcap.c
index 707875d374..3fdff7d052 100644
--- a/caputils/capture-wpcap.c
+++ b/caputils/capture-wpcap.c
@@ -865,7 +865,7 @@ get_interface_list(int *err, char **err_str)
/*
* No interfaces found.
*/
- *err = NO_INTERFACES_FOUND;
+ *err = 0;
if (err_str != NULL)
*err_str = NULL;
}
diff --git a/caputils/capture_ifinfo.h b/caputils/capture_ifinfo.h
index 7cb70abbdf..2353f06fed 100644
--- a/caputils/capture_ifinfo.h
+++ b/caputils/capture_ifinfo.h
@@ -81,8 +81,7 @@ extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)
/* Error values from "get_interface_list()/capture_interface_list()". */
#define CANT_GET_INTERFACE_LIST 1 /* error getting list */
-#define NO_INTERFACES_FOUND 2 /* list is empty */
-#define DONT_HAVE_PCAP 3 /* couldn't load WinPcap */
+#define DONT_HAVE_PCAP 2 /* couldn't load WinPcap */
void free_interface_list(GList *if_list);
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);
}
}
diff --git a/tshark.c b/tshark.c
index 5ac44b08e3..4980d77004 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1377,16 +1377,11 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
if_list = capture_interface_list(&err, &err_str,NULL);
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 2;
}
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index b747c5af17..17fa2a9a0d 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2329,16 +2329,11 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
if_list = capture_interface_list(&err, &err_str,main_window_update);
if (if_list == NULL) {
- switch (err) {
- case CANT_GET_INTERFACE_LIST:
- case DONT_HAVE_PCAP:
- 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;
+ 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);
}
exit(2);
}
diff --git a/ui/gtk/main_welcome.c b/ui/gtk/main_welcome.c
index 95c09dc0ab..1c1cb74c90 100644
--- a/ui/gtk/main_welcome.c
+++ b/ui/gtk/main_welcome.c
@@ -1076,6 +1076,13 @@ fill_capture_box(void)
capture_interface_list(&error, &err_str,main_window_update);
switch (error) {
+ case 0:
+ label_text = g_strdup("No interface can be used for capturing in "
+ "this system with the current configuration.\n"
+ "\n"
+ "See Capture Help below for details.");
+ break;
+
case CANT_GET_INTERFACE_LIST:
label_text = g_strdup_printf("No interface can be used for capturing in "
"this system with the current configuration.\n\n"
@@ -1085,13 +1092,6 @@ fill_capture_box(void)
err_str);
break;
- case NO_INTERFACES_FOUND:
- label_text = g_strdup("No interface can be used for capturing in "
- "this system with the current configuration.\n"
- "\n"
- "See Capture Help below for details.");
- break;
-
case DONT_HAVE_PCAP:
label_text = g_strdup("WinPcap doesn't appear to be installed. "
"In order to capture packets, WinPcap "
@@ -1140,7 +1140,7 @@ fill_capture_box(void)
g_signal_connect(w, "activate-link", G_CALLBACK(activate_link_cb), NULL);
#endif
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_LABEL, w);
- if (error == CANT_GET_INTERFACE_LIST || error == NO_INTERFACES_FOUND) {
+ if (error == CANT_GET_INTERFACE_LIST || error == 0) {
item_hb_refresh = welcome_button(GTK_STOCK_REFRESH,
"Refresh Interfaces",
"Get a new list of the local interfaces.",
diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c
index 53bca5c809..a4227feb23 100644
--- a/ui/gtk/prefs_capture.c
+++ b/ui/gtk/prefs_capture.c
@@ -1775,7 +1775,7 @@ ifopts_if_liststore_add(void)
if_list = capture_interface_list(&err, &err_str, main_window_update); /* if_list = ptr to first element of list (or NULL) */
if (if_list == NULL) {
- if (err != NO_INTERFACES_FOUND) {
+ if (err != 0) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_str);
}
g_free(err_str);
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index eee5d65758..7ec385ddf1 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -673,16 +673,11 @@ int main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
if_list = capture_interface_list(&err, &err_str,main_window_update);
if (if_list == NULL) {
- switch (err) {
- case CANT_GET_INTERFACE_LIST:
- case DONT_HAVE_PCAP:
- 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;
+ 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);
}
exit(2);
}