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

Re: [libvirt] [PATCH] build: use correct printf types for uid/gid



On 10/23/2012 03:25 AM, Michal Privoznik wrote:
>>
>> -    VIR_DEBUG("Dropping privileges of DEF to %u:%u", user, group);
>> +    VIR_DEBUG("Dropping privileges of DEF to %u:%u",
>> +              (unsigned int) user, (unsigned int) group);
>>
>>      if (virSetUIDGID(user, group) < 0)
>>          return -1;
>> @@ -920,7 +921,9 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
>>          }
>>          break;
>>      case VIR_DOMAIN_SECLABEL_DYNAMIC:
>> -        if (virAsprintf(&seclabel->label, "%d:%d", priv->user, priv->group) < 0) {
>> +        if (virAsprintf(&seclabel->label, "%d:%d",
>> +                        (unsigned int) priv->user,
>> +                        (unsigned int) priv->group) < 0) {
> 
> In fact, "%d" expects signed int.

Bah, serves me right for fixing the compiler warning without actually
looking at the code being fixed.  I'll push the obvious followup that
canonicalizes on %u, since half the code was already right.  POSIX
leaves it unspecified whether uid_t is signed or unsigned, but for this
usage, we want an unsigned printout.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]