mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
build: avoid compilation warnings
Detected on cygwin: util/util.c: In function 'virSetUIDGID': util/util.c:2824: warning: format '%d' expects type 'int', but argument 7 has type 'gid_t' [-Wformat] (and three other lines) * src/util/util.c (virSetUIDGID): Cast, as is done elsewhere in this file, to avoid printf type mismatch warnings.
This commit is contained in:
parent
b2dbc16044
commit
c685993d71
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* utils.c: common, generic utility functions
|
* utils.c: common, generic utility functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2010 Red Hat, Inc.
|
* Copyright (C) 2006-2011 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 Daniel P. Berrange
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
* Copyright (C) 2006, 2007 Binary Karma
|
* Copyright (C) 2006, 2007 Binary Karma
|
||||||
* Copyright (C) 2006 Shuveb Hussain
|
* Copyright (C) 2006 Shuveb Hussain
|
||||||
@ -2822,7 +2822,8 @@ virSetUIDGID(uid_t uid, gid_t gid)
|
|||||||
if (gid > 0) {
|
if (gid > 0) {
|
||||||
if (setregid(gid, gid) < 0) {
|
if (setregid(gid, gid) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot change to '%d' group"), gid);
|
_("cannot change to '%d' group"),
|
||||||
|
(unsigned int) gid);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2844,14 +2845,15 @@ virSetUIDGID(uid_t uid, gid_t gid)
|
|||||||
getpwuid_r(uid, &pwd, buf, bufsize, &pwd_result);
|
getpwuid_r(uid, &pwd, buf, bufsize, &pwd_result);
|
||||||
if (!pwd_result) {
|
if (!pwd_result) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot getpwuid_r(%d)"), uid);
|
_("cannot getpwuid_r(%d)"),
|
||||||
|
(unsigned int) uid);
|
||||||
VIR_FREE(buf);
|
VIR_FREE(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (initgroups(pwd.pw_name, pwd.pw_gid) < 0) {
|
if (initgroups(pwd.pw_name, pwd.pw_gid) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot initgroups(\"%s\", %d)"),
|
_("cannot initgroups(\"%s\", %d)"),
|
||||||
pwd.pw_name, pwd.pw_gid);
|
pwd.pw_name, (unsigned int) pwd.pw_gid);
|
||||||
VIR_FREE(buf);
|
VIR_FREE(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2859,7 +2861,8 @@ virSetUIDGID(uid_t uid, gid_t gid)
|
|||||||
# endif
|
# endif
|
||||||
if (setreuid(uid, uid) < 0) {
|
if (setreuid(uid, uid) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot change to uid to '%d'"), uid);
|
_("cannot change to uid to '%d'"),
|
||||||
|
(unsigned int) uid);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user