Skip to content

Commit

Permalink
T1172: vyatta_update_sysctl.pl does not support options that have mul…
Browse files Browse the repository at this point in the history
…tiple values

Updated vyatta_update_sysctl.pl, now handles multiple values
  • Loading branch information
daniel-pro authored Jan 21, 2019
1 parent 9df8abe commit 66234e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/system/vyatta_update_sysctl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ sub usage {
}

GetOptions(
"option=s{2}" => \@opts,
"option=s{2,}" => \@opts,
) or usage();

set_sysctl_value(@opts) if (@opts);
exit 0;

sub set_sysctl_value {
my ($sysctl_opt, $nvalue) = @_;
my ($sysctl_opt, @nvaluearr) = @_;
my $nvalue = join ' ',@nvaluearr;
my $ovalue = get_sysctl_value($sysctl_opt);

if ($nvalue ne $ovalue) {
my $cmd = "$SYSCTL -w $sysctl_opt=$nvalue 2>&1> /dev/null";
my $cmd = "$SYSCTL -w $sysctl_opt=\"$nvalue\" 2>&1> /dev/null";
system($cmd);
if ($? >> 8) {
die "exec of $SYSCTL failed: '$cmd'";
Expand Down

0 comments on commit 66234e3

Please sign in to comment.