From 2ecee50da815268294db4a5d80881dc2f0417c18 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 13 Mar 2026 05:43:49 +0000 Subject: util/nvmutil: further tidy up prw() Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'util/nvmutil/nvmutil.c') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b4ba3047..058657d9 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1648,8 +1648,11 @@ prw(int fd, void *mem, size_t nrw, off_t off_orig; ssize_t r; int saved_errno; + int prw_type; - if ((unsigned int)(rw_type ^ IO_PREAD) > IO_WRITE) { + prw_type = rw_type ^ IO_PREAD; + + if (prw_type > IO_WRITE) { errno = EIO; return -1; } @@ -1660,7 +1663,7 @@ prw(int fd, void *mem, size_t nrw, return -1; do { - r = do_rw(fd, mem, nrw, off, rw_type ^ IO_PREAD); + r = do_rw(fd, mem, nrw, off, prw_type); } while (r < 0 && errno == EINTR); saved_errno = errno; -- cgit v1.2.1