From: Andre Noll Date: Tue, 20 Dec 2016 20:18:27 +0000 (+0100) Subject: afh: Make sure we never return a negative chunk number. X-Git-Tag: v0.5.7~8 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=75919d6cae9d0992c7bfda986da5d18eac9c904c;p=paraslash.git afh: Make sure we never return a negative chunk number. With the old code this could happen if chunk zero is empty. --- diff --git a/afh_common.c b/afh_common.c index f36c32e2..dfbf7513 100644 --- a/afh_common.c +++ b/afh_common.c @@ -295,8 +295,8 @@ int32_t afh_get_start_chunk(int32_t approx_chunk_num, for (k = PARA_MAX(0, approx_chunk_num); k >= 0; k--) if (get_chunk_len(k, afhi) > 0) - break; - return k; + return k; + return 0; } /**