diff options
author | Guy Harris <gharris@sonic.net> | 2021-05-22 13:27:57 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-05-22 13:27:57 -0700 |
commit | 15026157949b394a71feaed61f968aa692d20885 (patch) | |
tree | 246bc939fb3cf37a9d7cf4c7af4cf4a3f6b21351 /file.c | |
parent | 54508703b0ac4d85df4104f6114a247d68c42b8e (diff) |
Remove a duplicate unlink.
In cf_export_specified_packets(), if the loop processing the packets
fails, we're going to go to the failure code, which will unlink the file
to which we were writing if we were writing to a temporary file, so we
don't need to unlink it before going there.
While we're at it, note why we don't report any error from
wtap_dump_close() in that case.
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -4879,11 +4879,12 @@ cf_export_specified_packets(capture_file *cf, const char *fname, break; case PSP_FAILED: - /* Error while saving. - If we're writing to a temporary file, remove it. */ - if (fname_new != NULL) - ws_unlink(fname_new); + /* Error while saving. */ wtap_dump_close(pdh, &err, &err_info); + /* + * We don't report any error from closing; the error that caused + * process_specified_records() to fail has already been reported. + */ goto fail; } |