From 8f8eeb5dcea62a1d4dd27cec193756844fe12c43 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 21 Jan 2014 08:50:35 +0000 Subject: Check the return of wtap_dump_close() even if we've gotten a read error; the only reason not to check it is if we've already gotten a write error and another write error would be superfluous (either "you got two of the same error" or "you got an I/O error *and* you ran out of disk space/disk quota" is of limited interest). Discard the return value of wtap_dump_close() in the case where we've already gotten a write error, in the hopes of squelching a Coverity warning. svn path=/trunk/; revision=54872 --- file.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index da53ea2274..4b66bb99c0 100644 --- a/file.c +++ b/file.c @@ -1548,11 +1548,18 @@ cf_merge_files(char **out_filenamep, int in_file_count, destroy_progress_dlg(progbar); merge_close_in_files(in_file_count, in_files); - if (!got_read_error && !got_write_error) { + if (!got_write_error) { if (!wtap_dump_close(pdh, &write_err)) got_write_error = TRUE; - } else - wtap_dump_close(pdh, &close_err); + } else { + /* + * We already got a write error; no need to report another + * write error on close. + * + * Don't overwrite the earlier write error. + */ + (void)wtap_dump_close(pdh, &close_err); + } if (got_read_error) { /* -- cgit v1.2.3