summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capture.c7
-rw-r--r--capture_opts.c1
-rw-r--r--capture_opts.h1
-rw-r--r--ui/gtk/capture_dlg.c1
4 files changed, 10 insertions, 0 deletions
diff --git a/capture.c b/capture.c
index 76882f086a..2131ad683c 100644
--- a/capture.c
+++ b/capture.c
@@ -646,6 +646,13 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
ws_unlink(capture_opts->save_file);
+ /* If we have a ring buffer, the original save file has been overwritten
+ with the "ring filename". Restore it before starting again */
+ if ((capture_opts->multi_files_on) && (capture_opts->orig_save_file != NULL)) {
+ g_free(capture_opts->save_file);
+ capture_opts->save_file = g_strdup(capture_opts->orig_save_file);
+ }
+
/* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */
if(cf_is_tempfile((capture_file *)cap_session->cf)) {
g_free(capture_opts->save_file);
diff --git a/capture_opts.c b/capture_opts.c
index 2e77bc1e44..53b6253346 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -97,6 +97,7 @@ capture_opts_init(capture_options *capture_opts)
capture_opts->show_info = TRUE;
capture_opts->quit_after_cap = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE;
capture_opts->restart = FALSE;
+ capture_opts->orig_save_file = NULL;
capture_opts->multi_files_on = FALSE;
capture_opts->has_file_duration = FALSE;
diff --git a/capture_opts.h b/capture_opts.h
index 05db1dec1b..f99dac62c1 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -186,6 +186,7 @@ typedef struct capture_options_tag {
gboolean show_info; /**< show the info dialog */
gboolean quit_after_cap; /**< Makes a "capture only mode". Implies -k */
gboolean restart; /**< restart after closing is done */
+ gchar *orig_save_file; /**< the original capture file name (saved for a restart) */
/* multiple files (and ringbuffer) */
gboolean multi_files_on; /**< TRUE if ring buffer in use */
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 9f2616f734..34845c3827 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -5515,6 +5515,7 @@ capture_dlg_prep(gpointer parent_w) {
if (g_save_file && g_save_file[0]) {
/* User specified a file to which the capture should be written. */
global_capture_opts.save_file = g_strdup(g_save_file);
+ global_capture_opts.orig_save_file = g_strdup(g_save_file);
/* Save the directory name for future file dialogs. */
cf_name = g_strdup(g_save_file);
dirname = get_dirname(cf_name); /* Overwrites cf_name */