File obs-server-2.9-0013-backend-Fix-cleanup-in-BSSched-EventSource-Directory.patch of Package obs-server
From 2ffa7846c5bd18f4bf836d007b6117c3d1ac5225 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Wed, 29 Jun 2016 20:00:40 +0100
Subject: [PATCH] [backend] Fix cleanup in BSSched::EventSource::Directory
test.
The $! (errno) variable is not assigned to zero upon successful
system call.
This means that value of $! should not be used to check whether
rmdir() or unlink() succeeded; return value should be checked instead.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
src/backend/t/0015-BSSched-EventSource-Directory.t | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/backend/t/0015-BSSched-EventSource-Directory.t b/src/backend/t/0015-BSSched-EventSource-Directory.t
index 0b666d0cee..de7c6f0996 100644
--- a/src/backend/t/0015-BSSched-EventSource-Directory.t
+++ b/src/backend/t/0015-BSSched-EventSource-Directory.t
@@ -258,8 +258,7 @@ push(@files_to_remove,"$ev_dir/$file_name");
unshift(@files_to_remove,"$eventdir_base/$arch/$evname");
for (@files_to_remove) {
- ( -d $_ ) ? rmdir $_ : unlink $_;
- warn "$_: $!" if $!;
+ ( -d $_ ) ? rmdir $_ : unlink $_ or warn "$_: $!" if $!;
}
exit 0;
--
2.20.1