From 5632b6e2982d2bc6e87ec738846de37fa552ea4a Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 9 Jun 2020 09:08:37 +0200 Subject: [PATCH] fixed the code to support hopefully any device name #272 --- lib/disk.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/disk.pm b/lib/disk.pm index ba6e2b2..d26b454 100644 --- a/lib/disk.pm +++ b/lib/disk.pm @@ -471,7 +471,7 @@ sub disk_cgi { for($n = 0; $n < 8; $n++) { if($d[$n]) { my $dstr = trim($d[$n]); - my $base; + my $base = ""; $dstr =~ s/^\"//; $dstr =~ s/\"$//; @@ -484,8 +484,12 @@ sub disk_cgi { } $dstr =~ s/^(.+?) .*$/$1/; - if($disk->{map}->{$base} || "" eq $dstr) { + if($base && defined($disk->{map}->{$base})) { $dstr = $disk->{map}->{$base}; + } else { + if(defined($disk->{map}->{$dstr})) { + $dstr = $disk->{map}->{$dstr}; + } } $str = sprintf("%-20s", $dstr); push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":$str");