• J
    virfile: Adjust error path for virFileOpenForked · 92d9114e
    John Ferlan 提交于
    Rather than have a dummy waitpid loop and return of the failure status
    from recvfd, adjust the logic to save the recvfd error & fd and then
    in priority order:
    
    - if waitpid failed, use that errno value
    - waitpid succeeded, but if the child exited abnormally, report failure
    (use EACCES to report as return failure, since either EACCES or EPERM is
    what caused us to fall into the fork+setuid path)
    - waitpid succeeded, but if the child reported non-zero status, report
    failure (use the errno value that the child encoded into exit status)
    - waitpid succeeded, but if recvfd failed, report recvfd_errno
    - waitpid and recvfd succeeded, use the fd
    
    NOTE: Original logic to retry the open and force owner mode was
    "documented" as only being attempted if we had already tried opening
    with the fork+setuid, but checked flags vs. VIR_FILE_OPEN_NOFORK which
    is counter to how we would get to that point. So that code was removed.
    92d9114e
virfile.c 81.1 KB