From 477f8116d517798d4d6456d920d57ff2f46d4271 Mon Sep 17 00:00:00 2001 From: Yaniv Levinsky Date: Sun, 24 Jun 2018 19:16:55 +0300 Subject: cmd: nvedit: propagate envflag to set_default_vars The env_flag in do_env_default() doesn't get propagated and therefore gets ignored by himport_r(). This breaks to ability to "forcibly" reset variables to their default values using the environment command. Scenario example of the problem: # setenv kernel uImage # setenv .flags kernel:so # env default -f kernel ## Error: Can't overwrite "kernel" himport_r: can't insert "kernel=zImage" into hash table Change the call path so it will pass the flag correctly. Signed-off-by: Yaniv Levinsky Acked-by: Igor Grinberg --- env/common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'env') diff --git a/env/common.c b/env/common.c index dc8a14f..6cf5edd 100644 --- a/env/common.c +++ b/env/common.c @@ -91,15 +91,16 @@ void set_default_env(const char *s) /* [re]set individual variables to their value in the default environment */ -int set_default_vars(int nvars, char * const vars[]) +int set_default_vars(int nvars, char * const vars[], int flags) { /* * Special use-case: import from default environment * (and use \0 as a separator) */ + flags |= H_NOCLEAR | H_INTERACTIVE; return himport_r(&env_htab, (const char *)default_environment, sizeof(default_environment), '\0', - H_NOCLEAR | H_INTERACTIVE, 0, nvars, vars); + flags, 0, nvars, vars); } /* -- cgit v1.1