aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture.c10
-rw-r--r--ui/gtk/capture_dlg.c11
-rw-r--r--ui/gtk/main.c6
3 files changed, 21 insertions, 6 deletions
diff --git a/capture.c b/capture.c
index b9c2f98f29..ddb0657741 100644
--- a/capture.c
+++ b/capture.c
@@ -138,13 +138,7 @@ capture_start(capture_options *capture_opts)
guint i;
GString *source = g_string_new("");
- if (capture_opts->state != CAPTURE_STOPPED)
- return FALSE;
capture_opts->state = CAPTURE_PREPARING;
-
- /* close the currently loaded capture file */
- cf_close(capture_opts->cf);
- collect_ifaces(capture_opts);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start ...");
#ifdef _WIN32
if (capture_opts->ifaces->len < 2) {
@@ -654,6 +648,10 @@ capture_input_closed(capture_options *capture_opts, gchar *msg)
if (capture_opts->ifaces->len == 0) {
collect_ifaces(capture_opts);
}
+
+ /* close the currently loaded capture file */
+ cf_close(capture_opts->cf);
+
capture_start(capture_opts);
} else {
/* We're not doing a capture any more, so we don't have a save file. */
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index f9e36b2e60..be5e969e24 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -4126,6 +4126,17 @@ capture_start_confirmed(void)
/* XXX - we might need to init other pref data as well... */
menu_auto_scroll_live_changed(auto_scroll_live);
+ /* XXX - can this ever happen? */
+ if (global_capture_opts.state != CAPTURE_STOPPED)
+ return;
+
+ /* close the currently loaded capture file */
+ cf_close(global_capture_opts.cf);
+
+ /* Copy the selected interfaces to the set of interfaces to use for
+ this capture. */
+ collect_ifaces(&global_capture_opts);
+
if (capture_start(&global_capture_opts)) {
/* The capture succeeded, which means the capture filter syntax is
valid; add this capture filter to the recent capture filter list. */
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 86fdedff13..ffabe3db9e 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -3031,6 +3031,12 @@ main(int argc, char *argv[])
/* "-k" was specified; start a capture. */
show_main_window(TRUE);
check_and_warn_user_startup(cf_name);
+
+ /* If no user interfaces were specified on the command line,
+ copy the list of selected interfaces to the set of interfaces
+ to use for this capture. */
+ if (global_capture_opts.ifaces->len == 0)
+ collect_ifaces(&global_capture_opts);
if (capture_start(&global_capture_opts)) {
/* The capture started. Open stat windows; we do so after creating
the main window, to avoid GTK warnings, and after successfully