From c0e75abff75f2fd11107c9da7c34f9265b6303e1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 14 Oct 2010 14:34:05 +0200 Subject: [PATCH] Fix compile warning on platforms with posix_fallocate Signed-off-by: Jens Axboe --- smalloc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/smalloc.c b/smalloc.c index 4cd8298e..42008ebf 100644 --- a/smalloc.c +++ b/smalloc.c @@ -178,7 +178,7 @@ static int find_next_zero(int word, int start) static int add_pool(struct pool *pool, unsigned int alloc_size) { - int fd, bitmap_blocks, ret; + int fd, bitmap_blocks; char file[] = "/tmp/.fio_smalloc.XXXXXX"; void *ptr; @@ -203,10 +203,14 @@ static int add_pool(struct pool *pool, unsigned int alloc_size) pool->free_blocks = bitmap_blocks * SMALLOC_BPB; #ifdef FIO_HAVE_FALLOCATE - ret = posix_fallocate(fd, 0, alloc_size); - if (ret > 0) { - fprintf(stderr, "posix_fallocate pool file failed: %s\n", strerror(ret)); - goto out_unlink; + { + int ret; + + ret = posix_fallocate(fd, 0, alloc_size); + if (ret > 0) { + fprintf(stderr, "posix_fallocate pool file failed: %s\n", strerror(ret)); + goto out_unlink; + } } #endif -- 2.25.1