From adaf87a17d47d4b8fdff3993484289e4e0a81041 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Thu, 22 Aug 2013 21:18:50 +0200 Subject: [PATCH] Checks for zero count in scrub. --- scrub.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scrub.c b/scrub.c index 3b8294e5..e0afda64 100644 --- a/scrub.c +++ b/scrub.c @@ -503,12 +503,17 @@ int state_scrub(struct snapraid_state* state) if (countlimit > count) countlimit = count; - /* get the time limit */ - timelimit = info_get_time(infomap[countlimit - 1]); + if (countlimit > 0) { + /* get the time limit */ + timelimit = info_get_time(infomap[countlimit - 1]); - /* don't scrub too recent blocks */ - if (timelimit > recentlimit) + /* don't scrub too recent blocks */ + if (timelimit > recentlimit) + timelimit = recentlimit; + } else { + /* we don't have a time limit based on quota */ timelimit = recentlimit; + } /* free the temp vector */ free(infomap);