From 6e607ace08d2b750304f0596a8f30d5409ef2696 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 29 Jun 2013 18:53:58 +0200 Subject: [PATCH] In check doesn't report as unrecoverable error the missing destination of hardlinks. --- Makefile.am | 1 - check.c | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 95480da5..ef3149d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/check.c b/check.c index d221ba37..237eb3d4 100644 --- a/check.c +++ b/check.c @@ -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)