mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE
Since commit0f036bf4b8
("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set") a warning message is displayed when setenv -f is used WITHOUT CONFIG_ENV_ACCESS_IGNORE_FORCE, but the variable is set anyway, resulting in lots of log pollution. env_flags_validate() returns 0 if the access is accepted, or non zero if it is refused. So the original code #ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE if (flag & H_FORCE) return 0; #endif was correct, it returns 0 (accepts the modification) if forced UNLESS IGNORE_FORCE is set (in which case access checks in the following code are applied). The broken patch just added a printf to the force accepted case. To obtain the intent of the patch we need this: if (flag & H_FORCE) { #ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE printf("## Error: Can't force access to \"%s\"\n", name); #else return 0; #endif } Fixes:0f036bf4b8
("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set") Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
This commit is contained in:
parent
b9c3052fbb
commit
9636bf8b2e
1 changed files with 3 additions and 2 deletions
5
env/flags.c
vendored
5
env/flags.c
vendored
|
@ -563,12 +563,13 @@ int env_flags_validate(const struct env_entry *item, const char *newval,
|
|||
return 1;
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE
|
||||
if (flag & H_FORCE) {
|
||||
#ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE
|
||||
printf("## Error: Can't force access to \"%s\"\n", name);
|
||||
#else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
switch (op) {
|
||||
case env_op_delete:
|
||||
if (item->flags & ENV_FLAGS_VARACCESS_PREVENT_DELETE) {
|
||||
|
|
Loading…
Reference in a new issue