From 2cb0841a1452f34a20ffe8fc1821b305f10b3f63 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 12 Jul 2024 10:52:33 -0600 Subject: [PATCH] os/os-qnx: fix overwrite of 'errno' You can't call perror() and expect errno to retain the same value, it'll be zero after that. On top of that, there's no reason to print the error here, the higher up layers will do that when an error is returned. Fixes: 946733c6f19c ("Support QNX OS platform") Signed-off-by: Jens Axboe --- os/os-qnx.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/os/os-qnx.h b/os/os-qnx.h index 8c0b76527..447c9957b 100755 --- a/os/os-qnx.h +++ b/os/os-qnx.h @@ -54,15 +54,14 @@ typedef unsigned int __u32; static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) { struct stat statbuf; + if (fstat(f->fd, &statbuf) == -1) { - perror("fstat"); - } else { - *bytes = (unsigned long long)(statbuf.st_blocksize * statbuf.st_nblocks); - return 0; + *bytes = 0; + return errno; } - *bytes = 0; - return errno; + *bytes = (unsigned long long)(statbuf.st_blocksize * statbuf.st_nblocks); + return 0; } static inline int blockdev_invalidate_cache(struct fio_file *f)