From 7f8551fccbc636c63bc93fe02c3a95d536e8d1e4 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 1 Mar 2013 18:48:13 +0100 Subject: [PATCH] Doesn't stop if a hardlink cannot be created because the target doesn't exist. --- check.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/check.c b/check.c index f4ae4039..e10fd327 100644 --- a/check.c +++ b/check.c @@ -1112,6 +1112,7 @@ static int state_check_process(struct snapraid_state* state, int check, int fix, struct stat stto; struct snapraid_link* link; int failed = 0; + int unrecoverable = 0; link = node->data; node = node->next; /* next node */ @@ -1146,6 +1147,12 @@ static int state_check_process(struct snapraid_state* state, int check, int fix, fprintf(stderr, "Error stating hardlink-to '%s'. %s.\n", pathto, strerror(errno)); fprintf(stderr, "hardlinkerror:%s:%s:%s: Hardlink to stat error\n", disk->name, link->sub, link->linkto); + if (errno == ENOENT) { + /* if the targer doesn't exist, it's unrecoverable */ + unrecoverable = 1; + ++unrecoverable_error; + } + ++error; } else if (!S_ISREG(stto.st_mode)) { failed = 1; @@ -1187,7 +1194,7 @@ static int state_check_process(struct snapraid_state* state, int check, int fix, } } - if (fix && failed) { + if (fix && failed && !unrecoverable) { /* create the ancestor directories */ ret = mkancestor(path); if (ret != 0) {