util: Don't overflow on errno in virFileAccessibleAs

If we need to virFork() to check assess() under different
UID+GID we need to translate returned status via WEXITSTATUS().
Otherwise, we may return values greater than 255 which is
obviously wrong.
This commit is contained in:
Michal Privoznik 2012-03-08 11:27:57 +01:00
parent 96b41f639d
commit f05fb6c56c

View File

@ -724,8 +724,13 @@ virFileAccessibleAs(const char *path, int mode,
return -1;
}
if (!WIFEXITED(status)) {
errno = EINTR;
return -1;
}
if (status) {
errno = status;
errno = WEXITSTATUS(status);
return -1;
}