testbot/lib: If we cannot open the log file, then log to stderr.
Francois Gouget
fgouget at codeweavers.com
Mon Oct 15 08:32:39 CDT 2012
---
testbot/lib/WineTestBot/Log.pm | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/testbot/lib/WineTestBot/Log.pm b/testbot/lib/WineTestBot/Log.pm
index 6883968..7de6dcb 100644
--- a/testbot/lib/WineTestBot/Log.pm
+++ b/testbot/lib/WineTestBot/Log.pm
@@ -38,20 +38,18 @@ sub LogMsg(@)
if (!defined $logfile)
{
my $oldumask = umask(002);
- if (open($logfile, ">>", "$LogDir/log"))
- {
- # Flush after each print
- my $tmp=select($logfile);
- $| = 1;
- select($tmp);
- }
- else
+ if (!open($logfile, ">>", "$LogDir/log"))
{
require File::Basename;
print STDERR File::Basename::basename($0), ":warning: could not open '$LogDir/log' for writing: $!\n";
- $logfile = undef;
+ open($logfile, ">>&=", 2);
}
umask($oldumask);
+
+ # Flush after each print
+ my $tmp=select($logfile);
+ $| = 1;
+ select($tmp);
}
print $logfile scalar localtime, " ", @_ if ($logfile);
}
--
1.7.10.4
More information about the wine-patches
mailing list