[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv2] build: use gnulib passfd for simpler SCM_RIGHTS code



On 04/25/2011 01:17 AM, Laine Stump wrote:
>> @@ -1529,26 +1513,20 @@ virFileOpenAs(const char *path, int openflags,
>> mode_t mode,
>>           VIR_FORCE_CLOSE(pair[1]);
>>
>>           do {
>> -            ret = recvmsg(pair[0],&msg, 0);
>> +            ret = recvfd(pair[0], 0);
>>           } while (ret<  0&&  errno == EINTR);

ret == -1 and errno == EACCES on failure to transfer fd...

>>
>> -        if (ret<  0) {
>> +        if (ret<  0&&  errno != EACCES) {
>>               ret = -errno;
>>               VIR_FORCE_CLOSE(pair[0]);
>>               while ((waitret = waitpid(pid, NULL, 0) == -1)
>>                      &&  (errno == EINTR));
>>               goto parenterror;
>> +        } else {
>> +            fd = ret;
>>           }

so now fd == -1...


>         if (!WIFEXITED(status) || (ret = -WEXITSTATUS(status)) == -EACCES ||
>             fd == -1) {
>             /* fall back to the simpler method, which works better in
>              * some cases */
>             return virFileOpenAsNoFork(path, openflags, mode, uid, gid, flags);
>         }

so this uses the fallback code, regardless of child exit status, and we
also ensured that the child got reaped.

> 
> What if errno == EACCES? Will we be getting all the error recovery we
> need in the caller?

Yes.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]