diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-18 03:59:06 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-18 04:04:44 +0000 |
| commit | 6be315cf040facf4c6267e4fdbf116a6319f18ef (patch) | |
| tree | 15f5ec41d7b21cb9a4f5c5e2eab07fc920fe7378 /util/nvmutil | |
| parent | 0fd38589530d9d163c3635ec88f47015b309d6c9 (diff) | |
nvmutil: remove redundant check
the actual cat function just writes to stdout
we need only check that the input is null, which
i've now done.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 9e6a4db4..df5e2d51 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1349,7 +1349,6 @@ cmd_helper_err(void) void cat(unsigned long nff) { - struct commands *cmd; struct xfile *f; unsigned long p; @@ -1357,16 +1356,12 @@ cat(unsigned long nff) check_null_command("cat"); - cmd = &x->cmd[x->i]; f = &x->f; p = 0; ff = 0; - if ((unsigned long)x->cat != nff || - !((cmd->run == cmd_helper_cat && nff == 0) || - (cmd->run == cmd_helper_cat16 && nff == 1) || - (cmd->run == cmd_helper_cat128 && nff == 15))) { + if ((unsigned long)x->cat != nff) { err(ECANCELED, "erroneous call to cat"); } @@ -1390,16 +1385,8 @@ cat(unsigned long nff) void cat_buf(unsigned char *b) { - struct commands *cmd; - - check_null_command("cat_buf"); - - cmd = &x->cmd[x->i]; - - if (!((cmd->run == cmd_helper_cat && x->cat == 0) || - (cmd->run == cmd_helper_cat16 && x->cat == 1) || - (cmd->run == cmd_helper_cat128 && x->cat == 15))) - err(ECANCELED, "erroneous call to cat"); + if (b == NULL) + err(errno, "null pointer in cat command"); if (rw_file_exact(STDOUT_FILENO, b, GBE_PART_SIZE, 0, IO_WRITE, LOOP_EAGAIN, LOOP_EINTR, |
