If the rename in a safe "Save As" fails, the current file's name has
[metze/wireshark/wip.git] / file.c
diff --git a/file.c b/file.c
index 854d52ec69dd1903ac8a64b7a8f1432f31aece88..2088d3319572621e5f3d4e4cac07a088288618e1 100644 (file)
--- a/file.c
+++ b/file.c
@@ -3983,11 +3983,13 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                     file_rename_error_message(errno), fname);
 #ifdef _WIN32
-      /* Attempt to reopen the file descriptors using fname. */
-      if (!wtap_fdreopen(cf->wth, fname, &err, compressed)) {
+      /* Attempt to reopen the random file descriptor using the
+         current file's filename.  (At this point, the sequential
+         file descriptor is closed.) */
+      if (!wtap_fdreopen(cf->wth, cf->filename, &err)) {
         /* Oh, well, we're screwed. */
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                      file_open_error_message(err, FALSE), fname);
+                      file_open_error_message(err, FALSE), cf->filename);
       }
 #endif
       goto fail;