mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] common: globalvar: fix removing multiple nvvars with wildcards
@ 2017-11-30 11:19 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2017-11-30 11:19 UTC (permalink / raw)
  To: Barebox List

nvvar_remove takes wildcards, so it can remove multiple variables. This
means we cannot return after the first loop iteration, but instead must
continue.

Fixes: 609d3edc3ad9 (common: globvar: let nvvar_remove() report non-existing variable)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc:
---
 common/globalvar.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index ee756e5140..77b89c1791 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -247,6 +247,7 @@ int nvvar_remove(const char *name)
 {
 	struct param_d *p, *tmp;
 	char *fname;
+	int ret = -ENOENT;
 
 	if (!IS_ENABLED(CONFIG_NVVAR))
 		return -ENOSYS;
@@ -262,10 +263,10 @@ int nvvar_remove(const char *name)
 		unlink(fname);
 		free(fname);
 
-		return 0;
+		ret = 0;
 	}
 
-	return -ENOENT;
+	return ret;
 }
 
 int nvvar_load(void)
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-30 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-30 11:19 [PATCH] common: globalvar: fix removing multiple nvvars with wildcards Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox