]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Fix printf format for uid_t|gid_t
authorPhilipp Hahn <hahn@univention.de>
Fri, 22 Feb 2013 16:36:30 +0000 (17:36 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Feb 2013 14:46:32 +0000 (15:46 +0100)
The uid_t|gid_t values are explicitly casted to "unsigned long", but the
printf() still used "%d", which is for signed values.

Change the format to "%u".

Signed-off-by: Philipp Hahn <hahn@univention.de>
src/util/virutil.c

index 7acda77f8909b86ec0bb1ac98178b2fd1c170eea..563f684c803b1ccab6b88034330c9debb209e082 100644 (file)
@@ -2691,7 +2691,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
     if (gid != (gid_t)-1) {
         if (setregid(gid, gid) < 0) {
             virReportSystemError(err = errno,
-                                 _("cannot change to '%d' group"),
+                                 _("cannot change to '%u' group"),
                                  (unsigned int) gid);
             goto error;
         }
@@ -2722,7 +2722,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
         }
 
         if (rc) {
-            virReportSystemError(err = rc, _("cannot getpwuid_r(%d)"),
+            virReportSystemError(err = rc, _("cannot getpwuid_r(%u)"),
                                  (unsigned int) uid);
             goto error;
         }
@@ -2730,7 +2730,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
         if (!pwd_result) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("getpwuid_r failed to retrieve data "
-                             "for uid '%d'"),
+                             "for uid '%u'"),
                            (unsigned int) uid);
             err = EINVAL;
             goto error;
@@ -2745,7 +2745,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
 # endif
         if (setreuid(uid, uid) < 0) {
             virReportSystemError(err = errno,
-                                 _("cannot change to uid to '%d'"),
+                                 _("cannot change to uid to '%u'"),
                                  (unsigned int) uid);
             goto error;
         }