Re: [libvirt] [PATCH] build: avoid compiler warning

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

 



2010/5/3 Eric Blake <eblake@xxxxxxxxxx>:
> Necessary on cygwin, where uid_t and gid_t are 4-byte long rather
> than int, causing gcc -Wformat warnings.
>
> * src/util/util.c (virFileOperationNoFork, virDirCreateNoFork)
> (virFileOperation, virDirCreate, virGetUserEnt): Cast uid_t and
> gid_t before passing to printf.
> * .gitignore: Ignore cygwin executables.

The .exe suffix is not cygwin specific. You should say here: Ignore
Windows executables.

> ---
>  .gitignore      |    1 +
>  src/util/util.c |   21 ++++++++++++---------
>  2 files changed, 13 insertions(+), 9 deletions(-)
>

> diff --git a/src/util/util.c b/src/util/util.c
> index 3209185..0c5a22b 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -74,11 +74,14 @@
>  #include "util.h"
>  #include "memory.h"
>  #include "threads.h"
> +#include "verify.h"
>
>  #ifndef NSIG
>  # define NSIG 32
>  #endif
>
> +verify(sizeof (gid_t) <= sizeof (int) && sizeof (uid_t) <= sizeof (int));
> +
>  #define VIR_FROM_THIS VIR_FROM_NONE
>
>  #define virUtilError(code, ...)                                            \
> @@ -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?

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]