From 18deae30a43d80158609aa9c7b08ef307844e8f4 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 27 Oct 2013 20:59:37 +0100 Subject: [PATCH] Sets NEW hash to 0 when converting them to DELETED blocks. This avoids to use not initialized hash for deleted blocks, when deleting files after an aborted sync. --- scan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scan.c b/scan.c index f0f022e4..c438598e 100644 --- a/scan.c +++ b/scan.c @@ -170,8 +170,11 @@ static void scan_file_remove(struct snapraid_state* state, struct snapraid_disk* case BLOCK_STATE_BLK : /* we keep the hash making it an "old" hash, because the parity is still containing data for it */ break; - case BLOCK_STATE_CHG : case BLOCK_STATE_NEW : + /* NEW blocks don't have a hash, then we set it to the 'unspecified' 0 value */ + memset(block->hash, 0, HASH_SIZE); + break; + case BLOCK_STATE_CHG : /* if we have not already cleared the undeterminated hash */ if (!state->clear_undeterminate_hash) { /* in these cases we don't know if the old state is still the one */