From af2eb422d5c83fde0ec5276d4e2e5c945152b0f4 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 31 Aug 2021 15:48:25 +0200 Subject: [PATCH] tools: smart: only throw error for smartctl fatal errors only bit 0-2 are fatal errors, bit 3-7 are used to indicate some drive conditions. for details see the manpage of smartctl(8) Signed-off-by: Dominik Csapak [ Thomas: resolved merge-conflict due to moved run_command ] Signed-off-by: Thomas Lamprecht --- src/tools/disks/smart.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/disks/smart.rs b/src/tools/disks/smart.rs index fefdbbe3..fb85f667 100644 --- a/src/tools/disks/smart.rs +++ b/src/tools/disks/smart.rs @@ -91,7 +91,9 @@ pub fn get_smart_data( }; command.arg(disk_path); - let output = pbs_tools::run_command(command, None)?; + let output = pbs_tools::run_command(command, Some(|exitcode| + (exitcode & 0b0111) == 0 // only bits 0-2 are fatal errors + ))?; let output: serde_json::Value = output.parse()?;