From 3e3f50b50141a1284c2aff33d5c6e30842d42b50 Mon Sep 17 00:00:00 2001 From: prpr Date: Mon, 20 Nov 2023 16:04:03 +0000 Subject: [PATCH] Fix return code decode from smartctl on self-test logs --- webif/html/diag/disk.jim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webif/html/diag/disk.jim b/webif/html/diag/disk.jim index 0bacbb5..85e22e5 100755 --- a/webif/html/diag/disk.jim +++ b/webif/html/diag/disk.jim @@ -191,8 +191,12 @@ puts { } -if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} { - set msg "" +if {[catch {exec /bin/smartctl -l selftest $device} msg]} { + set rc [lindex $::errorCode 2] + set rc $($rc eq "" ? 1 : [expr {$rc & 7}]) + if {$rc} { + set msg "" + } } set i 0