mirror of
https://xff.cz/git/u-boot/
synced 2025-11-01 19:05:51 +01:00
env: Handle write-once ethaddr and serial# generically
Use the variable access flags to implement the protection for ethaddr and serial# instead of hard-coding them. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
committed by
Tom Rini
parent
9d8d661d7f
commit
1d6cd0a3f6
17
tools/env/fw_env.c
vendored
17
tools/env/fw_env.c
vendored
@@ -369,23 +369,6 @@ int fw_env_write(char *name, char *value)
|
||||
return 0;
|
||||
|
||||
if (deleting || overwriting) {
|
||||
#ifndef CONFIG_ENV_OVERWRITE
|
||||
/*
|
||||
* Ethernet Address and serial# can be set only once
|
||||
*/
|
||||
if (
|
||||
(strcmp(name, "serial#") == 0) ||
|
||||
((strcmp(name, "ethaddr") == 0)
|
||||
#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
|
||||
&& (strcmp(oldval, __stringify(CONFIG_ETHADDR)) != 0)
|
||||
#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
|
||||
) ) {
|
||||
fprintf (stderr, "Can't overwrite \"%s\"\n", name);
|
||||
errno = EROFS;
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_ENV_OVERWRITE */
|
||||
|
||||
if (*++nxt == '\0') {
|
||||
*env = '\0';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user