diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-11-25 22:36:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-11-25 22:36:06 +0000 |
commit | 946d6918244bbf88119ee626b21eaaa950546e61 (patch) | |
tree | d243099ad70f8bc2eb7a0df9ceee1a826e32f610 /ui/gtk | |
parent | af892f0553af4a3bd09ee6fe956b5e6c2f6d7a2e (diff) |
Clean up indentation, add a comment, use "== 0" to test the result of
strcmp() to make it clearer that it's testing whether the strings are
equal.
svn path=/trunk/; revision=53586
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/gtk_iface_monitor.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ui/gtk/gtk_iface_monitor.c b/ui/gtk/gtk_iface_monitor.c index b0c505656f..4c134aac70 100644 --- a/ui/gtk/gtk_iface_monitor.c +++ b/ui/gtk/gtk_iface_monitor.c @@ -51,14 +51,19 @@ gtk_iface_mon_event_cb(const char *iface, int up) interface_options interface_opts; for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) { - device = g_array_index(global_capture_opts.all_ifaces, interface_t, ifs); - if (!strcmp(device.name, iface)) { - present = 1; - if (!up) { - for (j = 0; j < global_capture_opts.ifaces->len; j++) { - interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j); - if (strcmp(interface_opts.name, device.name) == 0) { - g_array_remove_index(global_capture_opts.ifaces, j); + device = g_array_index(global_capture_opts.all_ifaces, interface_t, ifs); + if (strcmp(device.name, iface) == 0) { + present = 1; + if (!up) { + /* + * Interface went down or disappeared; remove all instances + * of it from the current list of interfaces selected + * for capturing. + */ + for (j = 0; j < global_capture_opts.ifaces->len; j++) { + interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j); + if (strcmp(interface_opts.name, device.name) == 0) { + g_array_remove_index(global_capture_opts.ifaces, j); } } } |