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 ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature