From da9b1f03724d5cf6f187d48ed7f2c970b03a254f Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 24 Aug 2017 13:59:58 -0700 Subject: [PATCH] Fix perl errors https://www.virtualmin.com/node/53260 --- awstats.pl | 4 ++-- virtualmin-awstats-lib.pl | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/awstats.pl b/awstats.pl index 596e170..e7984c6 100755 --- a/awstats.pl +++ b/awstats.pl @@ -24,11 +24,11 @@ my $dname = shift(@ARGV); if ($debug) { - &generate_report($ARGV[0], *STDERR, 0); + &generate_report($dname, *STDERR, 0); } else { open(my $NULL, ">", "/dev/null"); - &generate_report($ARGV[0], $NULL, 0); + &generate_report($dname, $NULL, 0); close($NULL); } if ($output) { diff --git a/virtualmin-awstats-lib.pl b/virtualmin-awstats-lib.pl index f49710a..d86763b 100755 --- a/virtualmin-awstats-lib.pl +++ b/virtualmin-awstats-lib.pl @@ -215,7 +215,7 @@ sub find_cron_job my ($dom) = @_; my @jobs = &cron::list_cron_jobs(); my ($job) = grep { $_->{'user'} eq 'root' && - $_->{'command'} =~ /^\Q$cron_cmd\E\s+(--output\s+\S+\s+)?\Q$dom\E$/ } @jobs; + $_->{'command'} =~ /^\Q$cron_cmd\E\s+(--output\s+\S+\s+)?\Q$dom\E$/ } @jobs; return $job; } @@ -224,9 +224,11 @@ sub find_cron_job # internal list sub get_run_user { +my ($dname) = @_; +$dname ||= ""; my %runas; &read_file_cached($run_as_file, \%runas); -return $runas{$_[0]} || "root"; +return $runas{$dname} || "root"; } # save_run_user(domain, user)