]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
extrahd.cgi: Only grab details from the same disk once.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 15 Mar 2024 12:55:11 +0000 (13:55 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 15 Mar 2024 12:55:11 +0000 (13:55 +0100)
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 <stefan.schantl@ipfire.org>
html/cgi-bin/extrahd.cgi

index afe79479bd1ed0f0e277dabe4f7501642a746396..4dcaad961951a0fda422db97ef1248e4bedc93ec 100644 (file)
@@ -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.