On 05/23/2014 02:49 AM, Peter Krempa wrote:
>>
>> + if (uid == (uid_t) -1)
>> + src->drv->uid = geteuid();
>> + else
>> + src->drv->uid = uid;
>
> Do we need to do the conversion here, or can we store -1 and let other
> routines later do the conversion? I'm not sure if it matters either
> way, so I'm fine leaving it this way.
We've got a syntax check for that :)
src/storage/storage_driver.c:2825: if (uid == -1)
maint.mk: cast -1 to ([ug]id_t) before comparing against id
make: *** [sc_prohibit_risky_id_promotion] Error 1
The comparison to casted -1 is required (and the syntax check is correct
on that front); what I was asking was whether we need the entire if
statement to convert -1 into a uid up front, or whether we can just
store -1 here and let later clients convert to uid at the time it is
used. In other words, I was asking if you could collapse those four
lines into:
src->drv->uid = uid;
and whether all subsequent users would handle the -1 just fine.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org