From 4a8f42537945aeefcee43e6eb2f835de1916e1c3 Mon Sep 17 00:00:00 2001 From: wh201906 <1063042587@qq.com> Date: Fri, 8 Apr 2022 19:50:38 +0800 Subject: [PATCH] Fix a bug in "lf config" When executing "lf config --reset", the averaging will be 0 rather than 1(default). This is because the config.averaging is set to 1 at first.(line 621) Then this argument is overwritten unconditionally by "config.averaging = (avg == 1);"(line 634) --- client/src/cmdlf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index e18dd15b7..a2d7e2450 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -631,7 +631,9 @@ int CmdLFConfig(const char *Cmd) { if (use_134) config.divisor = LF_DIVISOR_134; - config.averaging = (avg == 1); + // check if the config.averaging is not set by if(reset){...} + if (config.averaging == -1) + config.averaging = (avg == 1); if (bps > -1) { // bps is limited to 8