Francois Gouget : testbot/UpdateTaskLogs: Fix error handling for the task.log and testbot.log renames.
Module: tools Branch: master Commit: 1db323cfd1f448bc976342d3d293e1b1caeab995 URL: https://source.winehq.org/git/tools.git/?a=commit;h=1db323cfd1f448bc976342d3... Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Thu Feb 6 15:13:36 2020 +0100 testbot/UpdateTaskLogs: Fix error handling for the task.log and testbot.log renames. The code checks that the target filename does not exist (so rename() does not clobber it), so it's very unlikely that the error is that the destination already exists. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- testbot/bin/UpdateTaskLogs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/testbot/bin/UpdateTaskLogs b/testbot/bin/UpdateTaskLogs index e1da826..c6f7b75 100755 --- a/testbot/bin/UpdateTaskLogs +++ b/testbot/bin/UpdateTaskLogs @@ -351,12 +351,17 @@ sub ProcessTaskLogs($$$) "old_log.err" => "old_testbot.log"); while (my ($OldName, $NewName) = each %LogMap) { - if (-f "$TaskDir/$OldName" and !-f "$TaskDir/$NewName" and - !rename("$TaskDir/$OldName", "$TaskDir/$NewName")) + next if (!-f "$TaskDir/$OldName"); + if (-f "$TaskDir/$NewName") { Error TaskKeyStr($Task) .": Could not rename $OldName because $NewName already exists\n"; $Rc = 1; } + elsif (!rename("$TaskDir/$OldName", "$TaskDir/$NewName")) + { + Error TaskKeyStr($Task) .": Could not rename $OldName to $NewName: $!\n"; + $Rc = 1; + } } # testbot.log is the only log which we expect to be empty.
participants (1)
-
Alexandre Julliard