From 076ac4486e71369c7f92ca4b333b9001f6aa2680 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 15 Mar 2024 13:55:11 +0100 Subject: [PATCH] extrahd.cgi: Only grab details from the same disk once. Only grab details (uuids, mountpoints) about a certain disk once. In case there are multiple mounts of the same disk to different places, the CGI got confused and messed up. Signed-off-by: Stefan Schantl --- html/cgi-bin/extrahd.cgi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index afe79479b..4dcaad961 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -641,7 +641,9 @@ sub get_mountpoints () { my $device = $tmp[-1]; # Add the mountpoint to the hash of mountpoints. - $mounts{"$device"} = $mpoint; + unless($mounts{"$device"}) { + $mounts{"$device"} = $mpoint; + } } # Close file handle. @@ -714,7 +716,9 @@ sub get_mountedfs () { $fs = lc($fs); # Add the mounted file system. - $mountedfs{$device} = $fs; + unless($mountedfs{$device}) { + $mountedfs{$device} = $fs; + } } # Close file handle. @@ -755,7 +759,9 @@ sub get_uuids () { my $dev = "$tmp[-1]"; # Add the device and uuid to the hash of uuids. - $uuids{$dev} = $uuid; + unless($uuids{$dev}) { + $uuids{$dev} = $uuid; + } } # Close directory handle. -- 2.39.5