From b30f9e56cd92906ccb97e046b8928d7de76b4b50 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Sun, 10 Aug 2014 10:08:52 +0200 Subject: Do not assume sizeof(size_t) This fixes an assumption that sizeof(size_t) == sizeof(uint64_t), which is not guaranteed. At least on NetBSD/i386, size_t is 32 bit long. Caught by tests/basics/file-snapshot.t BUG: 764655 Change-Id: Ib7620a2ffe8758521886af37bc280101a040d860 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/8441 Reviewed-by: Humble Devassy Chirammal Tested-by: Gluster Build System Reviewed-by: Dan Lambright --- xlators/features/qemu-block/src/qemu-block.c | 2 +- xlators/features/qemu-block/src/qemu-block.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/features/qemu-block/src') diff --git a/xlators/features/qemu-block/src/qemu-block.c b/xlators/features/qemu-block/src/qemu-block.c index 48bbf314048..768866f6429 100644 --- a/xlators/features/qemu-block/src/qemu-block.c +++ b/xlators/features/qemu-block/src/qemu-block.c @@ -316,7 +316,7 @@ qb_setxattr_format (call_frame_t *frame, xlator_t *this, call_stub_t *stub, qb_local->stub = stub; qb_local->inode = inode_ref (inode); - snprintf(qb_local->fmt, QB_XATTR_VAL_MAX, "%s:%lu", qb_inode->fmt, + snprintf(qb_local->fmt, QB_XATTR_VAL_MAX, "%s:%" PRId64, qb_inode->fmt, qb_inode->size); qb_coroutine (frame, qb_format_and_resume); diff --git a/xlators/features/qemu-block/src/qemu-block.h b/xlators/features/qemu-block/src/qemu-block.h index c95f2799ac6..21cdcec2613 100644 --- a/xlators/features/qemu-block/src/qemu-block.h +++ b/xlators/features/qemu-block/src/qemu-block.h @@ -40,7 +40,7 @@ typedef struct qb_inode { char fmt[QB_XATTR_VAL_MAX]; /* this is only the format, not "format:size" */ - size_t size; /* virtual size in bytes */ + uint64_t size; /* virtual size in bytes */ BlockDriverState *bs; int refcnt; uuid_t backing_gfid; -- cgit