Francois Gouget : testbot: Use the three parameter open() form.

Alexandre Julliard julliard at winehq.org
Tue Feb 25 16:02:34 CST 2020


Module: tools
Branch: master
Commit: d6f6d21b469aeda589700da81a0f254e2be849d5
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=d6f6d21b469aeda589700da81a0f254e2be849d5

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Feb 25 00:13:41 2020 +0100

testbot: Use the three parameter open() form.

This avoids potential issues if the filename starts with '<', '>', etc.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/WineTestBot/Patches.pm | 2 +-
 testbot/lib/WineTestBot/Tasks.pm   | 2 +-
 testbot/web/OldSubmit.pl           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 46b17e5..6af51d7 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -404,7 +404,7 @@ sub IsPatch($$)
 {
   my ($self, $Body) = @_;
 
-  if (open(BODY, "<" . $Body->path))
+  if (open(BODY, "<", $Body->path))
   {
     my $Line;
     while (defined($Line = <BODY>))
diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm
index 3568c9b..a5125f3 100644
--- a/testbot/lib/WineTestBot/Tasks.pm
+++ b/testbot/lib/WineTestBot/Tasks.pm
@@ -280,7 +280,7 @@ sub UpdateStatus($$)
     my ($JobId, $StepNo, $TaskNo) = @{$self->GetMasterKey()};
     my $OldUMask = umask(002);
     my $TaskDir = $self->CreateDir();
-    if (open TASKLOG, ">>$TaskDir/testbot.log")
+    if (open TASKLOG, ">>", "$TaskDir/testbot.log")
     {
       print TASKLOG "TestBot process got stuck or died unexpectedly\n";
       close TASKLOG;
diff --git a/testbot/web/OldSubmit.pl b/testbot/web/OldSubmit.pl
index e0ccda3..06ce275 100644
--- a/testbot/web/OldSubmit.pl
+++ b/testbot/web/OldSubmit.pl
@@ -636,7 +636,7 @@ sub OnPage1Next($)
   {
     my $StagingFile = $self->GetTmpStagingFullPath($BaseName);
     my $OldUMask = umask(002);
-    if (! open (OUTFILE,">$StagingFile"))
+    if (! open (OUTFILE,">", $StagingFile))
     {
       umask($OldUMask);
       $self->{ErrField} = "File";




More information about the wine-cvs mailing list