mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
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:
parent
96b41f639d
commit
f05fb6c56c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user