Pino Toscano
2016-Apr-14 13:25 UTC
[Libguestfs] [PATCH supermin] ext2: fix printf formatters
Use the right formatting placeholders, so it gives no warnings also on 32bit platforms. --- src/ext2fs-c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c index e45980a..cb9282b 100644 --- a/src/ext2fs-c.c +++ b/src/ext2fs-c.c @@ -31,6 +31,7 @@ #include <limits.h> #include <errno.h> #include <assert.h> +#include <inttypes.h> /* Inlining is broken in the ext2fs header file. Disable it by * defining the following: @@ -659,9 +660,9 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) */ blocks = ROUND_UP (statbuf.st_size, data->fs->blocksize); if (blocks > ext2fs_free_blocks_count (data->fs->super)) { - fprintf (stderr, "supermin: %s: needed %lu blocks (%d each) for " - "%lu bytes, available only %llu\n", - src, blocks, data->fs->blocksize, statbuf.st_size, + fprintf (stderr, "supermin: %s: needed %zu blocks (%d each) for " + "%" PRIu64 " bytes, available only %llu\n", + src, blocks, data->fs->blocksize, (uint64_t) statbuf.st_size, ext2fs_free_blocks_count (data->fs->super)); unix_error (ENOSPC, (char *) "block size", data->fs->device_name ? caml_copy_string (data->fs->device_name) : Val_none); -- 2.5.5
Richard W.M. Jones
2016-Apr-14 13:58 UTC
Re: [Libguestfs] [PATCH supermin] ext2: fix printf formatters
On Thu, Apr 14, 2016 at 03:25:18PM +0200, Pino Toscano wrote:> Use the right formatting placeholders, so it gives no warnings also on > 32bit platforms. > --- > src/ext2fs-c.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c > index e45980a..cb9282b 100644 > --- a/src/ext2fs-c.c > +++ b/src/ext2fs-c.c > @@ -31,6 +31,7 @@ > #include <limits.h> > #include <errno.h> > #include <assert.h> > +#include <inttypes.h> > > /* Inlining is broken in the ext2fs header file. Disable it by > * defining the following: > @@ -659,9 +660,9 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) > */ > blocks = ROUND_UP (statbuf.st_size, data->fs->blocksize); > if (blocks > ext2fs_free_blocks_count (data->fs->super)) { > - fprintf (stderr, "supermin: %s: needed %lu blocks (%d each) for " > - "%lu bytes, available only %llu\n", > - src, blocks, data->fs->blocksize, statbuf.st_size, > + fprintf (stderr, "supermin: %s: needed %zu blocks (%d each) for " > + "%" PRIu64 " bytes, available only %llu\n", > + src, blocks, data->fs->blocksize, (uint64_t) statbuf.st_size, > ext2fs_free_blocks_count (data->fs->super)); > unix_error (ENOSPC, (char *) "block size", > data->fs->device_name ? caml_copy_string (data->fs->device_name) : Val_none); > --ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Apparently Analagous Threads
- [supermin] [PATCH] ext2: check for needed block size
- [PATCH 1/3] ext2: create a struct for the OCaml 't' type
- [PATCH] ext2: Don't load whole files into memory when copying to the appliance (RHBZ#1113065).
- [LLVMdev] More questions on CompilerDriver.
- [LLVMdev] More questions on CompilerDriver.