[PATCH] nv: Fix variable removal in nvvar_save()

Sascha Hauer s.hauer at pengutronix.de
Thu Sep 22 01:10:24 PDT 2016


When nv variables are removed during runtime then they are
present again when saved with nvvar_save(). This is because nvvar_save()
does not delete variables that exist on the saved environment. Delete
/nv on the saved environment before saving the new variables.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/globalvar.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index 44e6528..9d67348 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -471,6 +471,7 @@ int nvvar_save(void)
 		defaultenv_load(TMPDIR, 0);
 
 	envfs_load(env, TMPDIR, 0);
+	unlink_recursive(TMPDIR "/nv", NULL);
 
 	list_for_each_entry(param, &nv_device.parameters, list) {
 		ret = __nv_save(TMPDIR "/nv", param->name,
-- 
2.8.1




More information about the barebox mailing list