diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-02 17:05:39 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-02 17:06:57 +0000 |
| commit | 8707695184bfef642ed8640f6cde7329a8eafe3d (patch) | |
| tree | a69efa757e6f39169c05468cce346ecff8c8e683 /util | |
| parent | c4138752c3ccb110eb839be1f9ab924782f2a93a (diff) | |
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 <leah@libreboot.org>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 13 |
1 files 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) { |
