Skip to content

Commit

Permalink
os/os-qnx: fix overwrite of 'errno'
Browse files Browse the repository at this point in the history
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: 946733c ("Support QNX OS platform")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Jul 12, 2024
1 parent d64a2d8 commit 2cb0841
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions os/os-qnx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2cb0841

Please sign in to comment.