build: cast [ug]id_t when printing

This is a recurring problem for cygwin :)
For example, see commit 23a4df88.

qemu/qemu_driver.c: In function 'qemuStateInitialize':
qemu/qemu_driver.c:691:13: error: format '%d' expects type 'int', but argument 8 has type 'uid_t' [-Wformat]

* src/qemu/qemu_driver.c (qemuStateInitialize): Add casts.
* daemon/remote.c (remoteDispatchAuthList): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2013-05-30 07:59:14 -06:00
parent 19a7f9fffb
commit f43bb1dc20
2 changed files with 12 additions and 8 deletions

View File

@ -1,7 +1,7 @@
/*
* remote.c: handlers for RPC method calls
*
* Copyright (C) 2007-2012 Red Hat, Inc.
* Copyright (C) 2007-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -2354,7 +2354,7 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED,
} else if (callerUid == 0) {
char *ident;
if (virAsprintf(&ident, "pid:%lld,uid:%d",
(long long) callerPid, callerUid) < 0) {
(long long) callerPid, (int) callerUid) < 0) {
virReportOOMError();
goto cleanup;
}

View File

@ -690,25 +690,29 @@ qemuStateInitialize(bool privileged,
if (chown(cfg->libDir, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership of '%s' to user %d:%d"),
cfg->libDir, cfg->user, cfg->group);
cfg->libDir, (int) cfg->user,
(int) cfg->group);
goto error;
}
if (chown(cfg->cacheDir, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership of '%s' to %d:%d"),
cfg->cacheDir, cfg->user, cfg->group);
cfg->cacheDir, (int) cfg->user,
(int) cfg->group);
goto error;
}
if (chown(cfg->saveDir, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership of '%s' to %d:%d"),
cfg->saveDir, cfg->user, cfg->group);
cfg->saveDir, (int) cfg->user,
(int) cfg->group);
goto error;
}
if (chown(cfg->snapshotDir, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership of '%s' to %d:%d"),
cfg->snapshotDir, cfg->user, cfg->group);
cfg->snapshotDir, (int) cfg->user,
(int) cfg->group);
goto error;
}
run_uid = cfg->user;
@ -752,8 +756,8 @@ qemuStateInitialize(bool privileged,
if (chown(mempath, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership on %s to %d:%d"),
mempath, cfg->user,
cfg->group);
mempath, (int) cfg->user,
(int) cfg->group);
goto error;
}
}