diff --git a/src/agent/src/config.rs b/src/agent/src/config.rs index 2c53bde203..1fd6345762 100644 --- a/src/agent/src/config.rs +++ b/src/agent/src/config.rs @@ -225,10 +225,9 @@ fn get_bool_value(param: &str) -> Result { // first try to parse as bool value v.parse::().or_else(|_err1| { // then try to parse as integer value - v.parse::().or_else(|_err2| Ok(0)).map(|v| match v { - 0 => false, - _ => true, - }) + v.parse::() + .or_else(|_err2| Ok(0)) + .map(|v| !matches!(v, 0)) }) } diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index 2a3942f82a..83d06c0a76 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -1399,7 +1399,7 @@ fn read_stream(fd: RawFd, l: usize) -> Result> { } Err(e) => match e { nix::Error::Sys(errno) => match errno { - Errno::EAGAIN => v.resize(0, 0), + Errno::EAGAIN => v.clear(), _ => return Err(anyhow!(nix::Error::Sys(errno))), }, _ => return Err(anyhow!("read error")),