Skip to content

Commit 3a68ca4

Browse files
committed
strict/warn
1 parent 265b3da commit 3a68ca4

File tree

5 files changed

+32
-24
lines changed

5 files changed

+32
-24
lines changed

acl_security.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
use strict;
2+
use warnings;
3+
our (%text, %in);
14

25
do 'virtualmin-nginx-lib.pl';
3-
our (%in);
46

57
# acl_security_form(&options)
68
# Output HTML for editing security options for the acl module
@@ -56,4 +58,3 @@ sub acl_security_save
5658
$o->{'user'} = $in{'user'};
5759
$o->{'stop'} = $in{'stop'};
5860
}
59-

fetch-directives.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/perl
2+
use strict;
3+
use warnings;
24

35
my @mods;
46
my %donemod;
@@ -14,6 +16,7 @@
1416
}
1517
push(@mods, [ "CoreModule", "core" ]);
1618

19+
my @dirs;
1720
foreach my $m (@mods) {
1821
my ($page, $mod) = @$m;
1922
my $dir;

php-loop.pl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#!/usr/bin/perl
22
# Simple script to run a sub-process in a loop
3-
3+
use strict;
4+
use warnings;
45
use POSIX;
56

6-
$dead = 0;
7+
my $dead = 0;
8+
my $childpid;
79

810
$SIG{'TERM'} = sub { $dead = 1;
9-
if ($childpid) {
10-
kill(TERM, $childpid);
11-
sleep(1); # Give it time to clean up
12-
kill(KILL, $childpid);
13-
}
14-
exit(1);
11+
if ($childpid) {
12+
kill('TERM', $childpid);
13+
sleep(1); # Give it time to clean up
14+
kill('KILL', $childpid);
15+
}
16+
exit(1);
1517
};
1618

1719
while(!$dead) {
18-
$start = time();
20+
my $start = time();
1921
$childpid = fork();
2022
if ($childpid == 0) {
2123
exec(@ARGV);
@@ -27,4 +29,3 @@
2729
sleep(5);
2830
}
2931
}
30-

virtual_feature.pl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ sub feature_setup
204204
my $temp = &transname();
205205
my $fh = "EXTRA";
206206
&open_tempfile($fh, ">$temp", 0, 1);
207-
&print_tempfile($fh,
207+
&print_tempfile($fh,
208208
join("\n", split(/\t+/, $config{'extra_dirs'}))."\n");
209209
&close_tempfile($fh);
210210
my $econf = &read_config_file($temp);
@@ -735,8 +735,10 @@ sub feature_disable
735735
&open_lock_tempfile($fh, ">$dis");
736736
&print_tempfile($fh, $msg);
737737
&close_tempfile($fh);
738+
no warnings "once";
738739
&set_ownership_permissions(
739740
undef, undef, 0644, $virtual_server::disabled_website);
741+
use warnings "once";
740742

741743
# Add location to force use of it
742744
if (!$clash) {
@@ -1218,27 +1220,30 @@ sub feature_bandwidth
12181220
foreach my $l (&unique(@logs)) {
12191221
foreach my $f (&virtual_server::all_log_files($l, $max_ltime)) {
12201222
local $_;
1223+
my $LOG;
12211224
if ($f =~ /\.gz$/i) {
1222-
open(LOG, "gunzip -c ".quotemeta($f)." |");
1225+
open($LOG, "<", "gunzip -c ".quotemeta($f)." |");
12231226
}
12241227
elsif ($f =~ /\.Z$/i) {
1225-
open(LOG, "uncompress -c ".quotemeta($f)." |");
1228+
open($LOG, "<", "uncompress -c ".quotemeta($f)." |");
12261229
}
12271230
else {
1228-
open(LOG, $f);
1231+
open($LOG, "<", $f);
12291232
}
1230-
while(<LOG>) {
1233+
while(<$LOG>) {
12311234
if (/^(\S+)\s+(\S+)\s+(\S+)\s+\[(\d+)\/(\S+)\/(\d+):(\d+):(\d+):(\d+)\s+(\S+)\]\s+"([^"]*)"\s+(\S+)\s+(\S+)/ && $12 ne "206") {
12321235
# Valid-looking log line .. work out the time
1236+
no warnings "once";
12331237
my $ltime = timelocal($9, $8, $7, $4, $virtual_server::apache_mmap{lc($5)}, $6-1900);
1238+
use warnings "once";
12341239
if ($ltime > $start) {
12351240
my $day = int($ltime / (24*60*60));
12361241
$bwinfo->{"web_".$day} += $13;
12371242
}
12381243
$max_ltime = $ltime if ($ltime > $max_ltime);
12391244
}
12401245
}
1241-
close(LOG);
1246+
close($LOG);
12421247
}
12431248
}
12441249
return $max_ltime;
@@ -1869,7 +1874,7 @@ sub feature_backup
18691874
&virtual_server::close_tempfile_as_domain_user($d, $fh);
18701875
if ($server->{'file'} eq &get_add_to_file($d->{'dom'}) &&
18711876
-d $config{'add_to'}) {
1872-
# Domain has it's own file, so save it completely for use
1877+
# Domain has it's own file, so save it completely for use
18731878
# when restoring
18741879
&virtual_server::copy_write_as_domain_user(
18751880
$server->{'file'}, $file."_complete");
@@ -2342,4 +2347,3 @@ sub fix_server_name_line
23422347
}
23432348

23442349
1;
2345-

virtualmin-nginx-lib.pl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ sub list_nginx_directives
502502
"$module_root_directory/nginx-directives", 1);
503503
foreach my $l (@$lref) {
504504
my ($module, $name, $default, $context) = split(/\t/, $l);
505-
$list_directives_cache{$name} =
505+
$list_directives_cache{$name} =
506506
{ 'module' => $module,
507507
'name' => $name,
508508
'default' => $default eq '-' ? undef : $default,
@@ -1607,8 +1607,8 @@ sub start_php_fcgi_server_command
16071607
close(STDIN); close(STDOUT); close(STDERR);
16081608
my @u = getpwnam($d->{'user'});
16091609
&switch_to_unix_user(\@u);
1610-
open(STDOUT, ">>$log");
1611-
open(STDERR, ">&STDOUT");
1610+
open(STDOUT, ">>", "$log");
1611+
open(STDERR, ">", "&STDOUT");
16121612
&clean_environment();
16131613
foreach my $e (keys %$envs_to_set) {
16141614
$ENV{$e} = $envs_to_set->{$e};
@@ -1887,4 +1887,3 @@ sub recursive_clear_lines
18871887
}
18881888

18891889
1;
1890-

0 commit comments

Comments
 (0)