mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Avoid to compose the file path if not necessary
This commit is contained in:
parent
cb8b3dc804
commit
dd29375af1
1 changed files with 2 additions and 2 deletions
|
|
@ -614,7 +614,6 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
struct snapraid_file* collide_file;
|
||||
struct snapraid_file* file;
|
||||
block_off_t file_pos;
|
||||
char path[PATH_MAX];
|
||||
uint64_t inode;
|
||||
|
||||
disk = handle[j].disk;
|
||||
|
|
@ -630,7 +629,6 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
}
|
||||
|
||||
file = fs_par2file_get(disk, i, &file_pos);
|
||||
pathprint(path, sizeof(path), "%s%s", disk->dir, file->sub);
|
||||
|
||||
/* if it isn't the last block in the file */
|
||||
if (!file_block_is_last(file, file_pos)) {
|
||||
|
|
@ -654,8 +652,10 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
/* if the file is damaged, meaning that a fix failed */
|
||||
if (file_flag_has(file, FILE_IS_DAMAGED)) {
|
||||
/* rename it to .unrecoverable */
|
||||
char path[PATH_MAX];
|
||||
char path_to[PATH_MAX];
|
||||
|
||||
pathprint(path, sizeof(path), "%s%s", disk->dir, file->sub);
|
||||
pathprint(path_to, sizeof(path_to), "%s%s.unrecoverable", disk->dir, file->sub);
|
||||
|
||||
/* ensure to close the file before renaming */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue