mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 14:02:52 +02:00
util/nvmutil: move write checks to writeGbe
doing it in main() is messy. better do it from the actual function. now the logic in main is clearer. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -147,10 +147,10 @@ main(int argc, char *argv[])
|
||||
err_if((errno = (cmd == NULL) ? EINVAL : errno)); /* bad user arg */
|
||||
|
||||
readGbe(); /* read gbe file into memory */
|
||||
(*cmd)(); /* operate on gbe file in memory, as per user command */
|
||||
|
||||
if ((gbeFileChanged) && (flags != O_RDONLY))
|
||||
writeGbe();
|
||||
(*cmd)(); /* operate on gbe file in memory */
|
||||
|
||||
writeGbe(); /* write changes back to file */
|
||||
|
||||
err_if((errno != 0) && (cmd != cmd_dump)); /* don't err on dump */
|
||||
return errno; /* errno can be set by the dump command */
|
||||
@@ -413,6 +413,9 @@ goodChecksum(int partnum)
|
||||
void
|
||||
writeGbe(void)
|
||||
{
|
||||
if ((!gbeFileChanged) || (flags == O_RDONLY))
|
||||
return;
|
||||
|
||||
for (int p = 0; p < 2; p++) {
|
||||
if ((!nvmPartChanged[p]))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user