From 8707695184bfef642ed8640f6cde7329a8eafe3d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 2 Mar 2026 17:05:39 +0000 Subject: util/nvmutil: rename openGbeFile to openFiles merge the urandom handling back into this function. it's called immediately after in main anyway, so we may as well. this reduces the size of main. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 62380f94..1ba3dc09 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -18,7 +18,7 @@ void cmd_setchecksum(void), cmd_brick(void), swap(int partnum), writeGbe(void), cmd_dump(void), cmd_setmac(void), nvmalloc(void), readGbe(void), checkdir(const char *path), macf(int partnum), hexdump(int partnum), parseMacString(const char *strMac, uint16_t *mac), cmd_swap(void), - openGbeFile(const char *path), cmd_copy(void), writeGbe_part(int), + openFiles(const char *path), cmd_copy(void), writeGbe_part(int), readGbe_part(int), usage(char*), set_io_flags(int, char **), set_cmd(int, char **); int goodChecksum(int partnum); @@ -90,10 +90,7 @@ main(int argc, char *argv[]) #ifdef __OpenBSD__ block_unveil(); #endif - checkdir("/dev/urandom"); - checkdir(fname); - xopen(rfd, "/dev/urandom", O_RDONLY); - openGbeFile(fname); + openFiles(fname); #ifdef __OpenBSD__ err_if(pledge("stdio", NULL) == -1); #endif @@ -161,8 +158,12 @@ checkdir(const char *path) } void -openGbeFile(const char *path) +openFiles(const char *path) { + checkdir("/dev/urandom"); + checkdir(fname); + + xopen(rfd, "/dev/urandom", O_RDONLY); xopen(fd, path, flags); switch(st.st_size) { -- cgit v1.2.1