aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-05-22 13:27:57 -0700
committerGuy Harris <gharris@sonic.net>2021-05-22 13:27:57 -0700
commit15026157949b394a71feaed61f968aa692d20885 (patch)
tree246bc939fb3cf37a9d7cf4c7af4cf4a3f6b21351 /file.c
parent54508703b0ac4d85df4104f6114a247d68c42b8e (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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/file.c b/file.c
index 7227eebc4c..17255c67e9 100644
--- a/file.c
+++ b/file.c
@@ -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;
}