[Libguestfs] [PATCH supermin] ext2: fix printf formatters

Richard W.M. Jones rjones at redhat.com
Thu Apr 14 13:58:21 UTC 2016


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




More information about the Libguestfs mailing list