If we save a temporary file by copying or writing, remove it when we're done.
Temporary files aren't supposed to stay around once we've done a save; the packets are now in the file to which we saved the contents. Bug: 14298 Change-Id: Ic64b1324fe92bda66ccbb82475ff75ad67637304 Reviewed-on: https://code.wireshark.org/review/25052 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
26222c96bb
commit
c5dbcca2e4
11
file.c
11
file.c
|
@ -4335,6 +4335,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
|
|||
}
|
||||
}
|
||||
#else
|
||||
/* Windows - copy the file to its new location. */
|
||||
how_to_save = SAVE_WITH_COPY;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -4472,6 +4473,14 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
|
|||
}
|
||||
}
|
||||
|
||||
/* If this was a temporary file, and we didn't do the save by doing
|
||||
a move, so the tempoary file is still around under its old name,
|
||||
remove it. */
|
||||
if (cf->is_tempfile) {
|
||||
/* If this fails, there's not much we can do, so just ignore errors. */
|
||||
ws_unlink(cf->filename);
|
||||
}
|
||||
|
||||
cf_callback_invoke(cf_cb_file_save_finished, NULL);
|
||||
cf->unsaved_changes = FALSE;
|
||||
|
||||
|
@ -4490,7 +4499,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
|
|||
break;
|
||||
|
||||
case SAVE_WITH_COPY:
|
||||
/* We just copied the file, s all the information other than
|
||||
/* We just copied the file, so all the information other than
|
||||
the wtap structure, the filename, and the "is temporary"
|
||||
status applies to the new file; just update that. */
|
||||
wtap_close(cf->provider.wth);
|
||||
|
|
Loading…
Reference in New Issue