From: Jens Axboe Date: Thu, 14 Oct 2010 12:34:05 +0000 (+0200) Subject: Fix compile warning on platforms with posix_fallocate X-Git-Tag: fio-1.44.1~2^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c0e75abff75f2fd11107c9da7c34f9265b6303e1 Fix compile warning on platforms with posix_fallocate Signed-off-by: Jens Axboe --- 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