In check doesn't report as unrecoverable error the missing destination of hardlinks.

This commit is contained in:
Andrea Mazzoleni 2013-06-29 18:53:58 +02:00
parent 33cf866699
commit 6e607ace08
2 changed files with 11 additions and 4 deletions

View file

@ -430,7 +430,6 @@ endif
echo --- Sync after all the fixes
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf sync
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf check
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -v -c $(srcdir)/test-raid6.conf status
echo Success!
# Manual testing

14
check.c
View file

@ -1237,9 +1237,17 @@ close_and_continue:
failed = 1;
if (errno == ENOENT) {
/* if the target doesn't exist, it's unrecoverable */
unrecoverable = 1;
++unrecoverable_error;
if (fix) {
/* if the target doesn't exist, it's unrecoverable */
/* because we cannot create an hardlink of a file that */
/* doesn't exists */
++unrecoverable_error;
} else {
/* but in check, we can assume that fixing will recover */
/* such missing file, so we assume a less drastic error */
++error;
}
}
fprintf(stdlog, "Error stating hardlink-to '%s'. %s.\n", pathto, strerror(errno));
@ -1524,7 +1532,7 @@ bail:
if (unrecoverable_error == 0)
return -1;
} else if (state->opt.expect_recoverable) {
if (error == 0)
if (unrecoverable_error != 0 || error == 0)
return -1;
} else {
if (error != 0 || unrecoverable_error != 0)