提交 7b4b59fa 编写于 作者: P Philipp Hahn 提交者: Michal Privoznik

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: NPhilipp Hahn <hahn@univention.de>
上级 e8b70ab7
...@@ -2691,7 +2691,7 @@ virSetUIDGID(uid_t uid, gid_t gid) ...@@ -2691,7 +2691,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
if (gid != (gid_t)-1) { if (gid != (gid_t)-1) {
if (setregid(gid, gid) < 0) { if (setregid(gid, gid) < 0) {
virReportSystemError(err = errno, virReportSystemError(err = errno,
_("cannot change to '%d' group"), _("cannot change to '%u' group"),
(unsigned int) gid); (unsigned int) gid);
goto error; goto error;
} }
...@@ -2722,7 +2722,7 @@ virSetUIDGID(uid_t uid, gid_t gid) ...@@ -2722,7 +2722,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
} }
if (rc) { if (rc) {
virReportSystemError(err = rc, _("cannot getpwuid_r(%d)"), virReportSystemError(err = rc, _("cannot getpwuid_r(%u)"),
(unsigned int) uid); (unsigned int) uid);
goto error; goto error;
} }
...@@ -2730,7 +2730,7 @@ virSetUIDGID(uid_t uid, gid_t gid) ...@@ -2730,7 +2730,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
if (!pwd_result) { if (!pwd_result) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("getpwuid_r failed to retrieve data " _("getpwuid_r failed to retrieve data "
"for uid '%d'"), "for uid '%u'"),
(unsigned int) uid); (unsigned int) uid);
err = EINVAL; err = EINVAL;
goto error; goto error;
...@@ -2745,7 +2745,7 @@ virSetUIDGID(uid_t uid, gid_t gid) ...@@ -2745,7 +2745,7 @@ virSetUIDGID(uid_t uid, gid_t gid)
# endif # endif
if (setreuid(uid, uid) < 0) { if (setreuid(uid, uid) < 0) {
virReportSystemError(err = errno, virReportSystemError(err = errno,
_("cannot change to uid to '%d'"), _("cannot change to uid to '%u'"),
(unsigned int) uid); (unsigned int) uid);
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册