Would flipping it around hurt less?
(I’d don’t speak perl but I think this would work!)
```
if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
$errormessage = "$Lang::tr{'extrahd cant umount'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd maybe the device is in use'}?";
} else {
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
@tmp = <FILE>;
close FILE;
open( FILE, "> $devicefile" ) or die "Unable to write $devicefile";
foreach $deviceentry (sort @tmp)
{
@tmpline = split( /\;/, $deviceentry );
if ( $tmpline[2] ne $extrahdsettings{'PATH'} )
{
print FILE $deviceentry;
}
}
close FILE;
}
```
Reviewed-by: Michael Tremer <
michael.tremer@ipfire.org>
The syntax pains me, but this is probably correct :)
On 2 Jun 2023, at 20:01, Jon Murphy <jon.murphy@ipfire.org> wrote:
-Fixes remove entries in 'extrahd' via the webinterface for extrahd.cgi file.
Suggested-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
---
html/cgi-bin/extrahd.cgi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi
index 36c0efc2e..9dd3a0eee 100644
--- a/html/cgi-bin/extrahd.cgi
+++ b/html/cgi-bin/extrahd.cgi
@@ -103,7 +103,7 @@ END
}
elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'})
{
- if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
+ if ( ! &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
@tmp = <FILE>;
close FILE;
--
2.30.2