[libvirt] [PATCH] build: use correct printf types for uid/gid
Eric Blake
eblake at redhat.com
Tue Oct 23 14:37:01 UTC 2012
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 at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121023/1a428899/attachment-0001.sig>
More information about the libvir-list
mailing list