summaryrefslogtreecommitdiffstats
path: root/cmd/nvedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/nvedit.c')
-rw-r--r--cmd/nvedit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 7fce723800..d0d2eca904 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -266,7 +266,9 @@ static int _do_env_set(int flag, int argc, char *const argv[], int env_flag)
/* Delete only ? */
if (argc < 3 || argv[2] == NULL) {
int rc = hdelete_r(name, &env_htab, env_flag);
- return !rc;
+
+ /* If the variable didn't exist, don't report an error */
+ return rc && rc != -ENOENT ? 1 : 0;
}
/*
@@ -895,7 +897,7 @@ static int do_env_delete(struct cmd_tbl *cmdtp, int flag,
while (--argc > 0) {
char *name = *++argv;
- if (!hdelete_r(name, &env_htab, env_flag))
+ if (hdelete_r(name, &env_htab, env_flag))
ret = 1;
}