summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-06-01 14:07:20 +0100
committerLeah Rowe <leah@libreboot.org>2023-06-01 14:07:20 +0100
commitbdccd7cb0c632a07e6d9feea4964ebbc18a48cd3 (patch)
tree9c7949459c861f3cf407776e5b0f58408a81361f /util
parent99258a38ae98ed9465fa1d149b1e5bdb18f8ca3c (diff)
util/nvmutil: don't call writeGbeFile if O_RDONLY
This replaces a check in the function for O_RDONLY, and fixes the bug where the "dump" command triggers such error. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 1e2b2b56..d9b79e61 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -50,7 +50,8 @@ main(int argc, char *argv[])
cmd_setmac(strMac); /* nvm gbe.bin setmac */
else if (cmd != NULL)
(*cmd)(); /* all other commands except setmac */
- writeGbeFile(FILENAME);
+ if ((gbeFileModified) && (flags != O_RDONLY))
+ writeGbeFile(FILENAME);
err_if((errno != 0) && (cmd != &cmd_dump));
return errno;
@@ -253,8 +254,6 @@ xorswap_buf(int partnum)
void
writeGbeFile(const char *filename)
{
- if (flags == O_RDONLY)
- err(ERR(), "Write aborted due to read-only mode: %s", filename);
if (gbeFileModified)
errno = 0;
for (int p = 0; p < 2; p++) {