aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-04-15 23:03:58 +0000
committerGuy Harris <guy@alum.mit.edu>2012-04-15 23:03:58 +0000
commit53155a11c0a111179c1ee8ad3b2327b127d0ac14 (patch)
tree3fff7316db904b65421994c9dabfd80d3bd879c3 /ui/gtk
parent70f67d065f1b69722df177a54c39d83f21fe3536 (diff)
Get rid of the error code argument to scan_local_interfaces(); nobody
uses it once it's filled in. From Evan Huus: in scan_local_interfaces(), pass NULL to capture_interface_list(), as we don't use the error string (and don't free it, either). In fill_capture_box(), for CANT_GET_INTERFACE_LIST, include the error string in the report, and free it, in all cases, when we're done with it. svn path=/trunk/; revision=42089
Diffstat (limited to 'ui/gtk')
-rw-r--r--ui/gtk/capture_dlg.c4
-rw-r--r--ui/gtk/main.c12
-rw-r--r--ui/gtk/main.h5
-rw-r--r--ui/gtk/main_welcome.c20
4 files changed, 19 insertions, 22 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 07f05270f4..d4d88a4792 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -2945,10 +2945,8 @@ apply_local_cb(GtkWidget *win _U_, gpointer *data _U_)
static void
rescan_local_cb(GtkWidget *button, gpointer *data _U_)
{
- int error;
-
gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
- scan_local_interfaces(&global_capture_opts, &error);
+ scan_local_interfaces(&global_capture_opts);
fill_local_list();
update_all_rows();
if (interfaces_dialog_window_present()) {
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 70a5b2869b..81cf2e8adc 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2037,7 +2037,6 @@ main(int argc, char *argv[])
char *gdp_path, *dp_path;
int err;
#ifdef HAVE_LIBPCAP
- int error;
gboolean start_capture = FALSE;
gboolean list_link_layer_types = FALSE;
GList *if_list;
@@ -2452,7 +2451,7 @@ main(int argc, char *argv[])
/*#ifdef HAVE_LIBPCAP
if (global_capture_opts.all_ifaces->len == 0) {
- scan_local_interfaces(&global_capture_opts, &error);
+ scan_local_interfaces(&global_capture_opts);
}
#endif*/
/* Now get our args */
@@ -2698,7 +2697,7 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
if (global_capture_opts.all_ifaces->len == 0) {
- scan_local_interfaces(&global_capture_opts, &error);
+ scan_local_interfaces(&global_capture_opts);
}
#endif
#ifdef HAVE_LIBPCAP
@@ -3975,12 +3974,12 @@ guint get_interface_type(gchar *name, gchar *description)
* those interfaces.
*/
void
-scan_local_interfaces(capture_options* capture_opts, int *error)
+scan_local_interfaces(capture_options* capture_opts)
{
GList *if_entry, *lt_entry, *if_list;
if_info_t *if_info, *temp;
char *if_string;
- gchar *descr, *err_str = NULL;
+ gchar *descr;
if_capabilities_t *caps=NULL;
gint linktype_count;
cap_settings_t cap_settings;
@@ -4005,8 +4004,7 @@ scan_local_interfaces(capture_options* capture_opts, int *error)
}
}
/* Scan through the list and build a list of strings to display. */
- if_list = capture_interface_list(&err, &err_str);
- *error = err;
+ if_list = capture_interface_list(&err, NULL);
count = 0;
for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) {
if_info = if_entry->data;
diff --git a/ui/gtk/main.h b/ui/gtk/main.h
index 77de5b694b..31f3fd8a9f 100644
--- a/ui/gtk/main.h
+++ b/ui/gtk/main.h
@@ -357,8 +357,9 @@ void hide_interface(gchar* new_hide);
/*
* Fetch the list of local interfaces with capture_interface_list()
* and set the list of "all interfaces" in *capture_opts to include
- * those interfaces.
+ * those interfaces. On failure, we just set the list to an empty
+ * list.
*/
-extern void scan_local_interfaces(capture_options* capture_opts, int *error);
+extern void scan_local_interfaces(capture_options* capture_opts);
#endif /* __MAIN_H__ */
diff --git a/ui/gtk/main_welcome.c b/ui/gtk/main_welcome.c
index bb7a447e19..22198917bc 100644
--- a/ui/gtk/main_welcome.c
+++ b/ui/gtk/main_welcome.c
@@ -1028,10 +1028,12 @@ static void fill_capture_box(void)
switch (error) {
case CANT_GET_INTERFACE_LIST:
- 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.");
+ label_text = g_strdup_printf("No interface can be used for capturing in "
+ "this system with the current configuration.\n\n"
+ "(%s)\n"
+ "\n"
+ "See Capture Help below for details.",
+ err_str);
break;
case NO_INTERFACES_FOUND:
@@ -1077,6 +1079,8 @@ static void fill_capture_box(void)
label_text = g_strdup_printf("Error = %d; this \"can't happen\".", error);
break;
}
+ if (err_str != NULL)
+ g_free(err_str);
w = gtk_label_new(label_text);
gtk_label_set_markup(GTK_LABEL(w), label_text);
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
@@ -1102,7 +1106,6 @@ welcome_if_tree_load(void)
GtkTreeSelection *entry;
interface_t device;
gboolean changed = FALSE;
- int error;
if (if_view && swindow) {
entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
@@ -1113,7 +1116,7 @@ welcome_if_tree_load(void)
gtk_tree_view_set_model(GTK_TREE_VIEW(if_view), GTK_TREE_MODEL (store));
/* LOAD THE INTERFACES */
if (global_capture_opts.all_ifaces->len == 0) {
- scan_local_interfaces(&global_capture_opts, &error);
+ scan_local_interfaces(&global_capture_opts);
if (global_capture_opts.all_ifaces->len == 0) {
fill_capture_box();
}
@@ -1213,9 +1216,6 @@ welcome_new(void)
GtkWidget *topic_capture_to_fill;
gchar *label_text;
GtkWidget *file_child_box;
-#ifdef HAVE_LIBPCAP
- int error;
-#endif
#ifdef _WIN32
DWORD chimney_enabled = 0;
DWORD ce_size = sizeof(chimney_enabled);
@@ -1283,7 +1283,7 @@ welcome_new(void)
#ifdef HAVE_LIBPCAP
if (global_capture_opts.all_ifaces->len == 0) {
- scan_local_interfaces(&global_capture_opts, &error);
+ scan_local_interfaces(&global_capture_opts);
}
fill_capture_box();