mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 20:06:56 -05:00
In fixing not recoverable files are renamed adding the ".unrecoverable" extension.
This commit is contained in:
parent
191dcdf3d4
commit
966bdf75ad
10 changed files with 62 additions and 17 deletions
29
check.c
29
check.c
|
|
@ -552,10 +552,31 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
/* nothing to do */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if the file is not fixed or if it's not fixable */
|
||||
if (!file_flag_has(handle[j].file, FILE_IS_FIXED)
|
||||
|| file_flag_has(handle[j].file, FILE_IS_DAMAGED)) {
|
||||
|
||||
/* if the file is damaged, meaning that a fix failed */
|
||||
if (file_flag_has(handle[j].file, FILE_IS_DAMAGED)) {
|
||||
/* rename it */
|
||||
char path_from[PATH_MAX];
|
||||
char path_to[PATH_MAX];
|
||||
|
||||
pathprint(path_from, sizeof(path_from), "%s%s", handle[j].disk->dir, handle[j].file->sub);
|
||||
pathprint(path_to, sizeof(path_to), "%s%s.unrecoverable", handle[j].disk->dir, handle[j].file->sub);
|
||||
|
||||
ret = rename(path_from, path_to);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Error renaming '%s' to '%s'. %s.\n", path_from, path_to, strerror(errno));
|
||||
fprintf(stderr, "WARNING! Without a working data disk, it isn't possible to fix errors on it.\n");
|
||||
printf("Stopping at block %u\n", i);
|
||||
++unrecoverable_error;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* and do not set the time */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if the file is not fixed */
|
||||
if (!file_flag_has(handle[j].file, FILE_IS_FIXED)) {
|
||||
/* nothing to do */
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue