cmd: correct return value for printenv -e
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 19 Jun 2022 11:36:48 +0000 (13:36 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 19 Jun 2022 13:53:09 +0000 (15:53 +0200)
If printenv -e is executed and the specified variable is not found, the
return value $? of the command should be 1 (false).

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/nvedit_efi.c

index 7ebb14e..770877c 100644 (file)
@@ -182,8 +182,10 @@ static int efi_dump_var_all(int argc,  char *const argv[],
        }
        free(var_name16);
 
-       if (!match && argc == 1)
+       if (!match && argc == 1) {
                printf("Error: \"%s\" not defined\n", argv[0]);
+               return CMD_RET_FAILURE;
+       }
 
        return CMD_RET_SUCCESS;
 }