diff options
Diffstat (limited to 'util/libreboot-utils/nvmutil.c')
| -rw-r--r-- | util/libreboot-utils/nvmutil.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/util/libreboot-utils/nvmutil.c b/util/libreboot-utils/nvmutil.c index ec41371f..ee20e851 100644 --- a/util/libreboot-utils/nvmutil.c +++ b/util/libreboot-utils/nvmutil.c @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: MIT - * Copyright (c) 2022-2026 Leah Rowe <leah@libreboot.org> - * +/* SPDX-License-Identifier: MIT ( >:3 ) + * Copyright (c) 2022-2026 Leah Rowe <leah@libreboot.org> /| |\ + * / \ * This tool lets you modify Intel GbE NVM (Gigabit Ethernet * Non-Volatile Memory) images, e.g. change the MAC address. * These images configure your Intel Gigabit Ethernet adapter. @@ -32,8 +32,11 @@ main(int argc, char *argv[]) struct xfile *f; size_t c; - (void) errhook(exit_cleanup); (void) lbsetprogname(argv[0]); + if (argc < 3) + usage(); + + (void) errhook(exit_cleanup); /* https://man.openbsd.org/pledge.2 */ /* https://man.openbsd.org/unveil.2 */ @@ -41,15 +44,15 @@ main(int argc, char *argv[]) xunveilx("/dev/urandom", "r"); #ifndef S_ISREG - err_exit(ECANCELED, + exitf( "Can't determine file types (S_ISREG undefined)"); #endif #if ((CHAR_BIT) != 8) - err_exit(ECANCELED, "Unsupported char size"); + exitf("Unsupported char size"); #endif if ((x = xstart(argc, argv)) == NULL) - err_exit(ECANCELED, "NULL state on init"); + exitf("NULL state on init"); /* parse user command */ /* TODO: CHECK ACCESSES VIA xstatus() */ @@ -69,7 +72,7 @@ main(int argc, char *argv[]) xpledgex("stdio flock rpath wpath cpath", NULL); if (cmd->run == NULL) - err_exit(errno, "Command not set"); + exitf("Command not set"); sanitize_command_list(); open_gbe_file(); @@ -85,7 +88,7 @@ main(int argc, char *argv[]) exit_cleanup(); if (f->io_err_gbe_bin) - err_exit(EIO, "%s: error writing final file"); + exitf("%s: error writing final file"); free_and_set_null(&f->tname); |
