qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH] virtfs-proxy-helper: check retur


From: Eric Blake
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid
Date: Wed, 10 Oct 2012 11:58:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 10/10/2012 10:17 AM, Paolo Bonzini wrote:
> Il 10/10/2012 18:14, Stefan Weil ha scritto:
>>>
>>>
>>> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
>>> index f9a8270..b34a84a 100644
>>> --- a/fsdev/virtfs-proxy-helper.c
>>> +++ b/fsdev/virtfs-proxy-helper.c
>>> @@ -290,8 +290,12 @@ static int setfsugid(int uid, int gid)
>>>           CAP_DAC_OVERRIDE,
>>>       };
>>>   -    setfsgid(gid);
>>> -    setfsuid(uid);
>>> +    if (setfsgid(gid) != 0) {
>>> +        return -1;
>>> +    }
>>
>> Wouldn't setfsgid(gid) == gid be also ok?
> 
> Of course, it should be < 0.  I have no idea how to test this thing...

POSIX states that uid_t and gid_t may be unsigned, so checking for < 0
is not necessarily possible (really, all you can check for is equality
with the same value as ((uid_t)-1) when put through integer promotion
rules).

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]