From 23a26390ce6dd95ada538fe1ecdf6425e01147b6 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 3 Sep 2011 10:19:18 +0200 Subject: [PATCH] Fixed --force-empty --- scan.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scan.c b/scan.c index d2e8f9fe..ba21a3bd 100644 --- a/scan.c +++ b/scan.c @@ -454,7 +454,6 @@ void state_scan(struct snapraid_state* state, int output) unsigned diskmax = tommy_array_size(&state->diskarr); unsigned i; struct snapraid_scan* scan; - int has_empty; scan = malloc_nofail(diskmax * sizeof(struct snapraid_scan)); for(i=0;idiskarr, i); + if (!state->force_empty) { + int has_empty = 0; + for(i=0;idiskarr, i); - if (scan[i].count_equal == 0 && scan[i].count_moved == 0 && scan[i].count_remove != 0) { - if (!has_empty) { - has_empty = 1; - fprintf(stderr, "All the files previously present in disk '%s' at dir '%s'", disk->name, disk->dir); - } else { - fprintf(stderr, ", disk '%s' at dir '%s'", disk->name, disk->dir); + if (scan[i].count_equal == 0 && scan[i].count_moved == 0 && scan[i].count_remove != 0) { + if (!has_empty) { + has_empty = 1; + fprintf(stderr, "All the files previously present in disk '%s' at dir '%s'", disk->name, disk->dir); + } else { + fprintf(stderr, ", disk '%s' at dir '%s'", disk->name, disk->dir); + } } } - } - if (has_empty) { - fprintf(stderr, " are now missing or rewritten!\n"); - fprintf(stderr, "This happens with an empty disk or when all the files are recreated after a 'fix' command.\n"); - fprintf(stderr, "If you really want to sync, use 'snapraid --force-empty sync'.\n"); - exit(EXIT_FAILURE); + if (has_empty) { + fprintf(stderr, " are now missing or rewritten!\n"); + fprintf(stderr, "This happens with an empty disk or when all the files are recreated after a 'fix' command.\n"); + fprintf(stderr, "If you really want to sync, use 'snapraid --force-empty sync'.\n"); + exit(EXIT_FAILURE); + } } if (state->verbose || output) {