From 6d70aac3a2bcec2dc5d472f119cbee2afdd8217c Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 22 Sep 2014 22:01:05 +1000 Subject: [PATCH] Clamp lower diff to 1 in proxy mode --- src/stratifier.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index 0a2c2d34..d0e8b375 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -879,6 +879,11 @@ static void update_diff(ckpool_t *ckp) json_dblcpy(&diff, val, "diff"); json_decref(val); + /* We only really care about integer diffs so clamp the lower limit to + * 1 or it will round down to zero. */ + if (unlikely(diff < 1)) + diff = 1; + ck_wlock(&workbase_lock); old_diff = proxy_base.diff; current_workbase->diff = proxy_base.diff = diff;