Simplifies a disk check to avoid static analyzer warnings.

This commit is contained in:
Andrea Mazzoleni 2014-11-15 18:33:39 +01:00
parent 23910358d0
commit 790e7dfa5e

View file

@ -631,9 +631,13 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* for each disk */
one_tocheck = 0;
for (j = 0; j < diskmax; ++j) {
struct snapraid_block* block = BLOCK_EMPTY;
if (handle[j].disk)
block = disk_block_get(handle[j].disk, i);
struct snapraid_block* block;
/* if no disk, nothing to check */
if (!handle[j].disk)
continue;
block = disk_block_get(handle[j].disk, i);
/* try to recover all files, even the ones without hash */
/* because in some cases we can recover also them */
@ -666,9 +670,13 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* for each disk */
one_tocheck = 0;
for (j = 0; j < diskmax; ++j) {
struct snapraid_block* block = BLOCK_EMPTY;
if (handle[j].disk)
block = disk_block_get(handle[j].disk, i);
struct snapraid_block* block;
/* if no disk, nothing to check */
if (!handle[j].disk)
continue;
block = disk_block_get(handle[j].disk, i);
/* try to recover all files, even the ones without hash */
/* because in some cases we can recover also them */