]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
qos.cgi: Use new perl system functions
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Jun 2021 13:45:27 +0000 (14:45 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Jun 2021 13:45:27 +0000 (14:45 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/qos.cgi

index db759147374c4d9c1a5f0b320cc31d9ff41f7110..fa566b5238a25a11e2efdd633133364735cfb1fc 100644 (file)
@@ -232,7 +232,7 @@ END
        open( FILE, "< $level7file" ) or die "Unable to read $level7file";
        @l7rules = <FILE>;
        close FILE;
-  system("rm $level7file");
+       &General::system("rm", "$level7file");
        foreach $l7ruleentry (sort @l7rules)
        {
                @l7ruleline = split( /\;/, $l7ruleentry );
@@ -244,13 +244,13 @@ END
                close FILE;
         }
          }
-       open( FILE, "< $level7file" ) or system("touch $level7file");close FILE;
+       open( FILE, "< $level7file" ) or &General::system("touch", "$level7file");close FILE;
        } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr{'edit'})
 {
        open( FILE, "< $level7file" ) or die "Unable to read $level7file";
        @l7rules = <FILE>;
        close FILE;
-       system("rm $level7file");
+       &General::system("rm", "$level7file");
        foreach $l7ruleentry (sort @l7rules)
        {
                @l7ruleline = split( /\;/, $l7ruleentry );
@@ -263,7 +263,7 @@ END
       }
     }
   &level7rule;
-  open( FILE, "< $level7file" ) or system("touch $level7file");close FILE;
+  open( FILE, "< $level7file" ) or &General::system("touch", "$level7file");close FILE;
  }
 
 ############################################################################################################################
@@ -323,7 +323,7 @@ END
        open( FILE, "< $portfile" ) or die "Unable to read $portfile";
        @portrules = <FILE>;
        close FILE;
-       system("rm $portfile");
+       &General::system("rm", "$portfile");
        foreach $portruleentry (sort @portrules)
        {
                @portruleline = split( /\;/, $portruleentry );
@@ -336,7 +336,7 @@ END
       }
     }
    &portrule;
-  open( FILE, "< $portfile" ) or system("touch $portfile");close FILE;
+  open( FILE, "< $portfile" ) or &General::system("touch", "$portfile");close FILE;
  }
 
 ############################################################################################################################
@@ -408,25 +408,25 @@ if ($qossettings{'ACTION'} eq $Lang::tr{'start'})
 {
        $qossettings{'ENABLED'} = 'on';
        &General::writehash("${General::swroot}/qos/settings", \%qossettings);
-       system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
-       system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
-       system("logger -t ipfire 'QoS started'");
+       &General::system("/usr/local/bin/qosctrl", "generate");
+       &General::system("/usr/local/bin/qosctrl", "start");
+       &General::system("logger", "-t", "ipfire", "QoS started");
 }
 elsif ($qossettings{'ACTION'} eq $Lang::tr{'stop'})
 {
        $qossettings{'ENABLED'} = 'off';
        &General::writehash("${General::swroot}/qos/settings", \%qossettings);
-       system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
-       system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
-       system("logger -t ipfire 'QoS stopped'");
+       &General::system("/usr/local/bin/qosctrl", "stop");
+       &General::system("/usr/local/bin/qosctrl", "generate");
+       &General::system("logger", "-t", "ipfire", "QoS stopped");
 }
 elsif ($qossettings{'ACTION'} eq $Lang::tr{'restart'})
 {
        if ($qossettings{'ENABLED'} eq 'on'){
-               system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
-               system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
-               system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
-               system("logger -t ipfire 'QoS restarted'");
+               &General::system("/usr/local/bin/qosctrl", "stop");
+               &General::system("/usr/local/bin/qosctrl", "generate");
+               &General::system("/usr/local/bin/qosctrl", "start");
+               &General::system("logger", "-t", "ipfire", "QoS restarted");
        }
 }
 elsif ($qossettings{'ACTION'} eq $Lang::tr{'save'})
@@ -530,9 +530,9 @@ END
                $qossettings{'ACK'} ="101";
                $qossettings{'ENABLED'} = 'on';
                &General::writehash("${General::swroot}/qos/settings", \%qossettings);
-               system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
-               system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
-               system("logger -t ipfire 'QoS started'");
+               &General::system("/usr/local/bin/qosctrl", "generate");
+               &General::system("/usr/local/bin/qosctrl", "start");
+               &General::system("logger", "-t", "ipfire", "QoS started");
        } else {
                $message = $Lang::tr{'qos enter bandwidths'};
        }