Code cleanup - always explicitly open for read
This commit is contained in:
parent
cddd999902
commit
68f4a3269d
@ -178,7 +178,7 @@ while(1) {
|
||||
# Transfer data from a file
|
||||
print STDERR "fastrpc: read $arg->{'file'}\n" if ($gconfig{'rpcdebug'});
|
||||
local ($data, $got);
|
||||
open(FILE, $arg->{'file'});
|
||||
open(FILE, "<$arg->{'file'}");
|
||||
binmode(FILE);
|
||||
while(read(FILE, $got, 1024) > 0) {
|
||||
$data .= $got;
|
||||
@ -194,7 +194,7 @@ while(1) {
|
||||
$rawrv = &serialise_variable(
|
||||
{ 'status' => 1, 'rv' => [ undef, "$arg->{'file'} is a directory" ] } );
|
||||
}
|
||||
elsif (!open(FILE, $arg->{'file'})) {
|
||||
elsif (!open(FILE, "<$arg->{'file'}")) {
|
||||
$rawrv = &serialise_variable(
|
||||
{ 'status' => 1, 'rv' => [ undef, "Failed to open $arg->{'file'} : $!" ] } );
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ if ($in{'config'} && !$gconfig{'nofeedbackconfig'}) {
|
||||
next if (!$f || -d $f);
|
||||
next if ($f =~ /\/var\/log\//);
|
||||
local $/ = undef;
|
||||
open(FILE, $f) || next;
|
||||
open(FILE, "<$f") || next;
|
||||
local $data = <FILE>;
|
||||
close(FILE);
|
||||
local $count = ($data =~ tr/[\000-\176]/[\000-\176]/);
|
||||
|
4
help.cgi
4
help.cgi
@ -21,7 +21,7 @@ if ($file =~ /\.(gif|jpg|jpeg|png)$/i) {
|
||||
# read the help file
|
||||
$path = &help_file($module, $file);
|
||||
@st = stat($path);
|
||||
open(HELP, $path) || &helperror(&text('help_efile', $path));
|
||||
open(HELP, "<$path") || &helperror(&text('help_efile', $path));
|
||||
read(HELP, $help, $st[7]);
|
||||
close(HELP);
|
||||
|
||||
@ -64,7 +64,7 @@ else {
|
||||
# including from this module
|
||||
local $ipath = &help_file($module, $_[0]);
|
||||
@st = stat($ipath);
|
||||
open(INC, $ipath) ||
|
||||
open(INC, "<$ipath") ||
|
||||
return "<i>".&text('help_einclude', $_[0])."</i><br>\n";
|
||||
read(INC, $inc, $st[7]);
|
||||
close(INC);
|
||||
|
@ -14,7 +14,7 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
|
||||
print "Set-Cookie: banner=1; path=/\r\n";
|
||||
&PrintHeader();
|
||||
$url = $in{'page'};
|
||||
open(BANNER, $gconfig{'loginbanner'});
|
||||
open(BANNER, "<$gconfig{'loginbanner'}");
|
||||
while(<BANNER>) {
|
||||
s/LOGINURL/$url/g;
|
||||
print;
|
||||
|
@ -137,7 +137,7 @@ elsif ($in{'pam'}) {
|
||||
exit(0);
|
||||
}
|
||||
waitpid($pid, 0);
|
||||
open(TEMP, $temp);
|
||||
open(TEMP, "<$temp");
|
||||
chop($rv = <TEMP>);
|
||||
chop($messages = <TEMP>);
|
||||
close(TEMP);
|
||||
|
6
rpc.cgi
6
rpc.cgi
@ -55,7 +55,7 @@ if ($arg->{'newsession'}) {
|
||||
while(1) {
|
||||
local ($rawcmd, $cmd, @rv);
|
||||
alarm($rcount ? 360 : 60);
|
||||
open(FIFO, $fifo1) || last;
|
||||
open(FIFO, "<$fifo1") || last;
|
||||
while(<FIFO>) {
|
||||
$rawcmd .= $_;
|
||||
}
|
||||
@ -145,7 +145,7 @@ elsif ($arg->{'action'} eq 'write') {
|
||||
elsif ($arg->{'action'} eq 'read') {
|
||||
# Transfer data from a file
|
||||
local ($data, $got);
|
||||
open(FILE, $arg->{'file'});
|
||||
open(FILE, "<$arg->{'file'}");
|
||||
while(read(FILE, $got, 1024) > 0) {
|
||||
$data .= $got;
|
||||
}
|
||||
@ -158,7 +158,7 @@ else {
|
||||
open(FIFO, ">$session->[0]");
|
||||
print FIFO $rawarg;
|
||||
close(FIFO);
|
||||
open(FIFO, $session->[1]);
|
||||
open(FIFO, "<$session->[1]");
|
||||
while(<FIFO>) {
|
||||
print;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
|
||||
print "Set-Cookie: banner=1; path=/\r\n";
|
||||
&PrintHeader();
|
||||
$url = $in{'page'};
|
||||
open(BANNER, $gconfig{'loginbanner'});
|
||||
open(BANNER, "<$gconfig{'loginbanner'}");
|
||||
while(<BANNER>) {
|
||||
s/LOGINURL/$url/g;
|
||||
print;
|
||||
|
@ -45,7 +45,7 @@ $start = time();
|
||||
while(1) {
|
||||
sleep(1);
|
||||
$now = time();
|
||||
if (!open(UPFILE, $upfile)) {
|
||||
if (!open(UPFILE, "<$upfile")) {
|
||||
# Doesn't exist yet
|
||||
if ($now - $start > 60) {
|
||||
# Give up after 60 seconds
|
||||
|
Loading…
x
Reference in New Issue
Block a user