From 4088bccc40644f45971304f4c73bc40dcfb87957 Mon Sep 17 00:00:00 2001 From: Yves Mettier Date: Fri, 26 Apr 2013 11:50:18 +0200 Subject: [PATCH] Fixed a bug with WriteQueueLengthLimitHigh is null/uninitialized Signed-off-by: Florian Forster --- src/configfile.c | 2 +- src/plugin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configfile.c b/src/configfile.c index 193e05d2..044180ee 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -936,7 +936,7 @@ long global_option_get_long_in_range (const char *option, long default_value, lo { long value; - assert(min < max); + assert(min <= max); value = global_option_get_long(option, default_value); if(value < min) return(default_value); if(value > max) return(default_value); diff --git a/src/plugin.c b/src/plugin.c index 4f1f6e16..0aee6466 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1449,7 +1449,7 @@ void plugin_init_all (void) post_cache_chain = fc_chain_get_by_name (chain_name); write_limit_high = global_option_get_long_in_range("WriteQueueLengthLimitHigh",0, 0, LONG_MAX); - write_limit_low = global_option_get_long_in_range("WriteQueueLengthLimitLow", (write_limit_high+1)/2, 0, write_limit_high-1 ); + write_limit_low = global_option_get_long_in_range("WriteQueueLengthLimitLow", (write_limit_high+1)/2, 0, (write_limit_high == 0) ? 0 : write_limit_high-1 ); { char const *tmp = global_option_get ("WriteThreads"); -- 2.30.2