Message ID | 1283074995-16395-1-git-send-email-avi@redhat.com |
---|---|
State | New |
Headers | show |
On 29.08.2010, at 11:43, Avi Kivity wrote: > stat() fields can be more or less anything depending on configuration, cast > explicitly to uint64_t to avoid printf() format mismatches. > > Signed-off-by: Avi Kivity <avi@redhat.com> I got a very similar patch in my queue: fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n", - s->ivshmem_size, buf.st_size); + s->ivshmem_size, (ulong)buf.st_size); But I guess your version is better - it loses less bits :). Acked-by: Alexander Graf <agraf@suse.de> Alex
Thanks, applied. On Sun, Aug 29, 2010 at 9:43 AM, Avi Kivity <avi@redhat.com> wrote: > stat() fields can be more or less anything depending on configuration, cast > explicitly to uint64_t to avoid printf() format mismatches. > > Signed-off-by: Avi Kivity <avi@redhat.com> > --- > hw/ivshmem.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/ivshmem.c b/hw/ivshmem.c > index bbb5cba..9a61c69 100644 > --- a/hw/ivshmem.c > +++ b/hw/ivshmem.c > @@ -351,9 +351,10 @@ static int check_shm_size(IVShmemState *s, int fd) { > fstat(fd, &buf); > > if (s->ivshmem_size > buf.st_size) { > - fprintf(stderr, "IVSHMEM ERROR: Requested memory size greater"); > - fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n", > - s->ivshmem_size, buf.st_size); > + fprintf(stderr, > + "IVSHMEM ERROR: Requested memory size greater" > + " than shared object size (%" PRIu64 " > %" PRIu64")\n", > + s->ivshmem_size, (uint64_t)buf.st_size); > return -1; > } else { > return 0; > -- > 1.7.1 > > >
diff --git a/hw/ivshmem.c b/hw/ivshmem.c index bbb5cba..9a61c69 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -351,9 +351,10 @@ static int check_shm_size(IVShmemState *s, int fd) { fstat(fd, &buf); if (s->ivshmem_size > buf.st_size) { - fprintf(stderr, "IVSHMEM ERROR: Requested memory size greater"); - fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n", - s->ivshmem_size, buf.st_size); + fprintf(stderr, + "IVSHMEM ERROR: Requested memory size greater" + " than shared object size (%" PRIu64 " > %" PRIu64")\n", + s->ivshmem_size, (uint64_t)buf.st_size); return -1; } else { return 0;
stat() fields can be more or less anything depending on configuration, cast explicitly to uint64_t to avoid printf() format mismatches. Signed-off-by: Avi Kivity <avi@redhat.com> --- hw/ivshmem.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)