From 18f39ab6fafde132af48350d7c976afa5716038f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 1 Jun 2023 11:56:01 +0100 Subject: util/nvmutil: clean up rhex() Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'util/nvmutil/nvmutil.h') diff --git a/util/nvmutil/nvmutil.h b/util/nvmutil/nvmutil.h index c951148f..1b928a34 100644 --- a/util/nvmutil/nvmutil.h +++ b/util/nvmutil/nvmutil.h @@ -51,8 +51,10 @@ int big_endian; #define ERR() errno = errno ? errno : ECANCELED #define err_if(x) if (x) err(ERR(), NULL) -#define xopen(f,l,p) if (opendir(l) != NULL) err(errno = EISDIR, "%s", l); \ - if (f == -1) if ((f = open(l, p)) == -1) err(ERR(), "%s", l); \ +#define xopen(f,l,p) \ + if (f == -1) \ + if (opendir(l) != NULL) err(errno = EISDIR, "%s", l); \ + if ((f = open(l, p)) == -1) err(ERR(), "%s", l); \ struct stat st; if (fstat(f, &st) == -1) err(ERR(), "%s", l) #define xpread(f, b, n, o, l) if (pread(f, b, n, o) == -1) err(ERR(), "%s", l) #define handle_endianness() if (big_endian) xorswap_buf(p) -- cgit v1.2.1