mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
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>
This commit is contained in:
@@ -1349,7 +1349,6 @@ cmd_helper_err(void)
|
|||||||
void
|
void
|
||||||
cat(unsigned long nff)
|
cat(unsigned long nff)
|
||||||
{
|
{
|
||||||
struct commands *cmd;
|
|
||||||
struct xfile *f;
|
struct xfile *f;
|
||||||
|
|
||||||
unsigned long p;
|
unsigned long p;
|
||||||
@@ -1357,16 +1356,12 @@ cat(unsigned long nff)
|
|||||||
|
|
||||||
check_null_command("cat");
|
check_null_command("cat");
|
||||||
|
|
||||||
cmd = &x->cmd[x->i];
|
|
||||||
f = &x->f;
|
f = &x->f;
|
||||||
|
|
||||||
p = 0;
|
p = 0;
|
||||||
ff = 0;
|
ff = 0;
|
||||||
|
|
||||||
if ((unsigned long)x->cat != nff ||
|
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))) {
|
|
||||||
|
|
||||||
err(ECANCELED, "erroneous call to cat");
|
err(ECANCELED, "erroneous call to cat");
|
||||||
}
|
}
|
||||||
@@ -1390,16 +1385,8 @@ cat(unsigned long nff)
|
|||||||
void
|
void
|
||||||
cat_buf(unsigned char *b)
|
cat_buf(unsigned char *b)
|
||||||
{
|
{
|
||||||
struct commands *cmd;
|
if (b == NULL)
|
||||||
|
err(errno, "null pointer in cat command");
|
||||||
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 (rw_file_exact(STDOUT_FILENO, b,
|
if (rw_file_exact(STDOUT_FILENO, b,
|
||||||
GBE_PART_SIZE, 0, IO_WRITE, LOOP_EAGAIN, LOOP_EINTR,
|
GBE_PART_SIZE, 0, IO_WRITE, LOOP_EAGAIN, LOOP_EINTR,
|
||||||
|
|||||||
Reference in New Issue
Block a user