]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: use correct printf types for uid/gid
authorEric Blake <eblake@redhat.com>
Mon, 22 Oct 2012 20:39:14 +0000 (14:39 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 22 Oct 2012 20:41:00 +0000 (14:41 -0600)
Fixes a build failure on cygwin:
cc1: warnings being treated as errors
security/security_dac.c: In function 'virSecurityDACSetProcessLabel':
security/security_dac.c:862:5: error: format '%u' expects type 'unsigned int', but argument 7 has type 'uid_t' [-Wformat]
security/security_dac.c:862:5: error: format '%u' expects type 'unsigned int', but argument 8 has type 'gid_t' [-Wformat]

* src/security/security_dac.c (virSecurityDACSetProcessLabel)
(virSecurityDACGenLabel): Use proper casts.

src/security/security_dac.c

index a67f5d63a035b99e9e9cde5e88d4ac38e575e487..a1aa0ef8243762838ec88a2fe73e692cfba4a5b7 100644 (file)
@@ -859,7 +859,8 @@ virSecurityDACSetProcessLabel(virSecurityManagerPtr mgr,
     if (virSecurityDACGetIds(def, priv, &user, &group))
         return -1;
 
-    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) {
             virReportOOMError();
             return rc;
         }