[tools] testbot: Use the three parameter open() form.

Francois Gouget fgouget at codeweavers.com
Mon Feb 24 17:13:41 CST 2020


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

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 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 46b17e52a1..6af51d7655 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 3568c9b8be..a5125f3420 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 e0ccda3a33..06ce27565b 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";
-- 
2.20.1




More information about the wine-devel mailing list