Better path management.

This commit is contained in:
Andrea Mazzoleni 2011-04-30 10:57:23 +02:00
parent bdb8167320
commit 4d49242350
2 changed files with 5 additions and 3 deletions

View file

@ -593,6 +593,8 @@ void state_check(struct snapraid_state* state, int fix, block_off_t blockstart,
}
pathcpy(parity_path, sizeof(parity_path), state->parity);
pathcpy(qarity_path, sizeof(qarity_path), state->qarity);
if (fix) {
/* if fixing, create the file and open for writing */
/* if it fails, we cannot continue */
@ -603,7 +605,6 @@ void state_check(struct snapraid_state* state, int fix, block_off_t blockstart,
}
if (state->level >= 2) {
pathcpy(qarity_path, sizeof(qarity_path), state->qarity);
qarity_f = parity_create(qarity_path, size);
if (qarity_f == -1) {
fprintf(stderr, "WARNING! Without an accessible Q-Parity file, it isn't possible to fix any error.\n");
@ -622,7 +623,6 @@ void state_check(struct snapraid_state* state, int fix, block_off_t blockstart,
}
if (state->level >= 2) {
pathcpy(qarity_path, sizeof(qarity_path), state->qarity);
qarity_f = parity_open(qarity_path);
if (qarity_f == -1) {
printf("No accessible Q-Parity file, only files will be checked.\n");

4
sync.c
View file

@ -287,6 +287,9 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
}
pathcpy(parity_path, sizeof(parity_path), state->parity);
pathcpy(qarity_path, sizeof(qarity_path), state->qarity);
/* create the file and open for writing */
parity_f = parity_create(parity_path, size);
if (parity_f == -1) {
fprintf(stderr, "WARNING! Without an accessible Parity file, it isn't possible to sync.\n");
@ -294,7 +297,6 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
}
if (state->level >= 2) {
pathcpy(qarity_path, sizeof(qarity_path), state->qarity);
qarity_f = parity_create(qarity_path, size);
if (qarity_f == -1) {
fprintf(stderr, "WARNING! Without an accessible Q-Parity file, it isn't possible to sync.\n");