Remove a clang warning about file var being potentially 0

This commit is contained in:
Andrea Mazzoleni 2015-04-21 21:33:39 +02:00
parent 618af56a13
commit 0a46ac605a

View file

@ -79,15 +79,17 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
/* if the file is closed or different than the current one */
if (handle[j].file == 0 || handle[j].file != block_file_get(block)) {
struct snapraid_file* file = handle[j].file;
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(file->sub), strerror(errno));
log_fatal("DANGER! Unexpected close error in a data disk, it isn't possible to dry.\n");
log_fatal("Stopping at block %u\n", i);
++error;
goto bail;
/* LCOV_EXCL_STOP */
if (file != 0) {
ret = handle_close(&handle[j]);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("error:%u:%s:%s: Close error. %s\n", i, disk->name, esc(file->sub), strerror(errno));
log_fatal("DANGER! Unexpected close error in a data disk, it isn't possible to dry.\n");
log_fatal("Stopping at block %u\n", i);
++error;
goto bail;
/* LCOV_EXCL_STOP */
}
}
/* open the file only for reading */