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
This commit is contained in:
Guy Harris 2014-01-21 08:50:35 +00:00
parent 0bc06ee3ab
commit 8f8eeb5dce
2 changed files with 20 additions and 6 deletions

13
file.c
View File

@ -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) {
/*

View File

@ -468,11 +468,18 @@ main(int argc, char *argv[])
}
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) {
/*