On Wed, Feb 22, 2012 at 10:21:04 +0100, Michal Privoznik wrote:
Despite documentation, if we do fork() parent always returns -1
even if file is accessible. Which is wrong obviously.
---
src/util/util.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 3406b7b..04a0e79 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -724,8 +724,12 @@ virFileAccessibleAs(const char *path, int mode,
return -1;
}
- errno = status;
- return -1;
+ if (!status) {
Are you sure about that '!' here? :-)
+ errno = status;
+ return -1;
+ }
+
+ return 0;
}
/* child.
ACK with the condition fixed.
BTW, as currently written virFileAccessibleAs does not distinguish between a
real error and inaccessible file. But I guess no caller needs this actually.
Jirka