summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-01-27 05:27:50 +0100
committerByron Jones <glob@mozilla.com>2015-01-27 05:27:50 +0100
commit90244813fe8110fc91f3746ebd93880e1c911cf1 (patch)
tree34ff732e860855956f043d0a41db8b2f30ef0095 /Bugzilla
parenta748745d3eb9110b0c6bcd803d8d86db8951ad43 (diff)
downloadbugzilla-90244813fe8110fc91f3746ebd93880e1c911cf1.tar.gz
bugzilla-90244813fe8110fc91f3746ebd93880e1c911cf1.tar.xz
Bug 1124432: Backport upstream bug 1079065 to bmo/4.2 to fix improper use of open() calls
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm4
-rw-r--r--Bugzilla/Config/Common.pm2
-rw-r--r--Bugzilla/Error.pm2
-rw-r--r--Bugzilla/Install/CPAN.pm4
-rw-r--r--Bugzilla/Install/Filesystem.pm2
-rw-r--r--Bugzilla/PatchReader/AddCVSContext.pm2
-rw-r--r--Bugzilla/PatchReader/Raw.pm2
-rw-r--r--Bugzilla/Send/Sendmail.pm2
8 files changed, 10 insertions, 10 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index 33a4c55a5..8361c1cce 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -344,7 +344,7 @@ sub data {
# If there's no attachment data in the database, the attachment is stored
# in a local file, so retrieve it from there.
if (length($self->{data}) == 0) {
- if (open(AH, $self->_get_local_filename())) {
+ if (open(AH, '<', $self->_get_local_filename())) {
local $/;
binmode AH;
$self->{data} = <AH>;
@@ -390,7 +390,7 @@ sub datasize {
# is stored in a local file, and so retrieve its size from the file,
# or the attachment has been deleted.
unless ($self->{datasize}) {
- if (open(AH, $self->_get_local_filename())) {
+ if (open(AH, '<', $self->_get_local_filename())) {
binmode AH;
$self->{datasize} = (stat(AH))[7];
close(AH);
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index edd5872e1..35a70994b 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -257,7 +257,7 @@ sub check_webdotbase {
# Check .htaccess allows access to generated images
my $webdotdir = bz_locations()->{'webdotdir'};
if(-e "$webdotdir/.htaccess") {
- open HTACCESS, "$webdotdir/.htaccess";
+ open HTACCESS, "<", "$webdotdir/.htaccess";
if(! grep(/ \\\.png\$/,<HTACCESS>)) {
return "Dependency graph images are not accessible.\nAssuming that you have not modified the file, delete $webdotdir/.htaccess and re-run checksetup.pl to rectify.\n";
}
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm
index 6e3309778..8c6888b49 100644
--- a/Bugzilla/Error.pm
+++ b/Bugzilla/Error.pm
@@ -87,7 +87,7 @@ sub _throw_error {
$val = "*****" if $val =~ /password|http_pass/i;
$mesg .= "[$$] " . Data::Dumper->Dump([$val],["env($var)"]);
}
- open(ERRORLOGFID, ">>$datadir/errorlog");
+ open(ERRORLOGFID, ">>", "$datadir/errorlog");
print ERRORLOGFID "$mesg\n";
close ERRORLOGFID;
}
diff --git a/Bugzilla/Install/CPAN.pm b/Bugzilla/Install/CPAN.pm
index 31bd7f88f..e6afa1f3b 100644
--- a/Bugzilla/Install/CPAN.pm
+++ b/Bugzilla/Install/CPAN.pm
@@ -222,8 +222,8 @@ sub set_cpan_config {
# Calling a senseless autoload that does nothing makes us
# automatically load any existing configuration.
# We want to avoid the "invalid command" message.
- open(my $saveout, ">&STDOUT");
- open(STDOUT, '>/dev/null');
+ open(my $saveout, ">&", "STDOUT");
+ open(STDOUT, '>', '/dev/null');
eval { CPAN->ignore_this_error_message_from_bugzilla; };
undef $@;
close(STDOUT);
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 2b7e3781c..5d4d84f88 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -644,7 +644,7 @@ sub _update_old_charts {
($in_file =~ /\.orig$/i));
rename("$in_file", "$in_file.orig") or next;
- open(IN, "$in_file.orig") or next;
+ open(IN, "<", "$in_file.orig") or next;
open(OUT, '>', $in_file) or next;
# Fields in the header
diff --git a/Bugzilla/PatchReader/AddCVSContext.pm b/Bugzilla/PatchReader/AddCVSContext.pm
index 910e45669..e4100afb1 100644
--- a/Bugzilla/PatchReader/AddCVSContext.pm
+++ b/Bugzilla/PatchReader/AddCVSContext.pm
@@ -190,7 +190,7 @@ sub push_context_lines {
if (Bugzilla::PatchReader::CVSClient::cvs_co_rev($this->{CVSROOT}, $this->{REVISION}, $this->{FILENAME})) {
die "Could not check out $this->{FILENAME} r$this->{REVISION} from $this->{CVSROOT}";
}
- open my $fh, $this->{FILENAME} or die "Could not open $this->{FILENAME}";
+ open(my $fh, '<', $this->{FILENAME}) or die "Could not open $this->{FILENAME}";
$this->{FILE} = $fh;
$this->{NEXT_FILE_LINE} = 1;
trick_taint($olddir); # $olddir comes from getcwd()
diff --git a/Bugzilla/PatchReader/Raw.pm b/Bugzilla/PatchReader/Raw.pm
index b58ed3a2d..7e34bd4bf 100644
--- a/Bugzilla/PatchReader/Raw.pm
+++ b/Bugzilla/PatchReader/Raw.pm
@@ -234,7 +234,7 @@ sub iterate_file {
my $this = shift;
my ($filename) = @_;
- open FILE, $filename or die "Could not open $filename: $!";
+ open(FILE, '<', $filename) or die "Could not open $filename: $!";
$this->start_lines($filename);
while (<FILE>) {
$this->next_line($_);
diff --git a/Bugzilla/Send/Sendmail.pm b/Bugzilla/Send/Sendmail.pm
index 9513134f4..0c3cfe9e4 100644
--- a/Bugzilla/Send/Sendmail.pm
+++ b/Bugzilla/Send/Sendmail.pm
@@ -29,7 +29,7 @@ sub send {
my $pipe = gensym;
- open($pipe, "| $mailer -t -oi @args")
+ open($pipe, '|-', "$mailer -t -oi @args")
|| return failure "Error executing $mailer: $!";
print($pipe $message->as_string)
|| return failure "Error printing via pipe to $mailer: $!";