On 05/03/2010 03:41 PM, Matthias Bolte wrote:
> @@ -1277,7 +1280,7 @@ static int virFileOperationNoFork(const
char *path, int openflags, mode_t mode,
> && (fchown(fd, uid, gid) < 0)) {
> ret = errno;
> virReportSystemError(errno, _("cannot chown '%s' to (%u,
%u)"),
> - path, uid, gid);
> + path, (int) uid, (int) gid);
Passing int for %u? Shouldn't this be a cast to unsigned int instead?
Technically, the two should match, to cater to weirdnix systems where
signedness changes the underlying size of the data (at least, my
understanding is that C99 allows such weirdness, even though no one
produces hardware like that). But gcc doesn't warn about
signed/unsigned mismatch, just about long/int mismatch, so the patch as
is was sufficient to silence the warning.
At any rate, you've convinced me; some uses were %u; others were %d
(which, on cygwin, has the potential to show as a negative number, since
it is entirely feasible to have a uid_t with the most significant bit
set); I'm changing all uses to be %u and cast to unsigned. v2 patch
coming up soon.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org