diff options
author | Leah Rowe <leah@libreboot.org> | 2023-01-27 15:34:09 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-01-27 15:34:09 +0000 |
commit | 7a98649764347a1485a1bf819db71cc3560244e1 (patch) | |
tree | d6af94aeb29bae46df8dd65f4a56ec505a69fc9d | |
parent | bb6fe263e73a05bba916a43360e49b2d4387cc00 (diff) |
util/nvmutil: call pledge() earlier, in main()
-rw-r--r-- | util/nvmutil/nvmutil.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 875ab147..d68585a5 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -77,6 +77,11 @@ main(int argc, char *argv[]) char *strRMac = "??:??:??:??:??:??"; void (*cmd)(void) = NULL; +#ifdef HAVE_PLEDGE + if (pledge("stdio wpath", NULL) == -1) + err(errno, "pledge"); +#endif + if ((buf = (uint8_t *) malloc(SIZE_8KB)) == NULL) err(errno, NULL); gbe[0] = gbe[1] = (size_t) buf; @@ -88,10 +93,6 @@ main(int argc, char *argv[]) test = 1; little_endian = ((uint8_t *) &test)[0]; -#ifdef HAVE_PLEDGE - if (pledge("stdio wpath", NULL) == -1) - err(errno, "pledge"); -#endif if (argc == 3) { if (strcmp(COMMAND, "dump") == 0) { #ifdef HAVE_PLEDGE |