diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-27 05:18:38 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-27 05:18:38 +0000 |
commit | c70117c79c4818ccd7bc9dd43331119525bfddad (patch) | |
tree | d5a20d6e13ddcfd2b5364ef7bc7098af37a53194 | |
parent | cf5a63e65ca0c08e88525567b8de50e875f996b5 (diff) |
util/nvmutil: clean up readonly check on writeGbe
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b88375a5..4eecebe6 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -435,13 +435,10 @@ goodChecksum(int partnum) void writeGbe(void) { - if ((flags == O_RDONLY)) - return; - ssize_t tnw = 0; /* total bytes written */ for (int p = 0; p < 2; p++) { - if ((!nvmPartChanged[p])) + if ((!nvmPartChanged[p]) || (flags == O_RDONLY)) continue; swap(p); /* swap bytes on big-endian host CPUs */ @@ -455,7 +452,7 @@ writeGbe(void) tnw += nf; } - if ((!tnw) && !(nvmPartChanged[0] || nvmPartChanged[1])) + if ((!tnw) && (flags != O_RDONLY)) fprintf(stderr, "No changes needed on file '%s'\n", filename); else if (tnw) printf("%ld bytes written to file '%s'\n", tnw, filename); |