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

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

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]