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

[libvirt] [PATCH 1/4] util: Fix printf format for uid_t|gid_t



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 |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index 7acda77..563f684 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -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;
         }
-- 
1.7.10.4


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