diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-13 05:43:49 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-13 05:43:49 +0000 |
| commit | 2ecee50da815268294db4a5d80881dc2f0417c18 (patch) | |
| tree | df81139510f4f10443e53766d87eead815799023 /util/nvmutil/nvmutil.c | |
| parent | e4b8be5b0cac5affe2433a0cf0670708cdba7789 (diff) | |
util/nvmutil: further tidy up prw()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |
