mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Enrico Jorns <ejo@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Enrico Jorns <ejo@pengutronix.de>
Subject: [PATCH 4/6] common: globvar: let nvvar_remove() report non-existing variable
Date: Wed,  1 Nov 2017 08:27:08 +0100	[thread overview]
Message-ID: <20171101072710.31518-5-ejo@pengutronix.de> (raw)
In-Reply-To: <20171101072710.31518-1-ejo@pengutronix.de>

The former implementation did not allow to detect whether the call to
nvvar_remove() succeeded or failed and always returned 0.

This changes the implementation to return 0 only if a variable with the
given name was found and return ENOENT otherwise.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 common/globalvar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index fdfaf76fae..ee756e5140 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -261,9 +261,11 @@ int nvvar_remove(const char *name)
 
 		unlink(fname);
 		free(fname);
+
+		return 0;
 	}
 
-	return 0;
+	return -ENOENT;
 }
 
 int nvvar_load(void)
-- 
2.11.0


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

  parent reply	other threads:[~2017-11-01  7:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01  7:27 [PATCH v3 0/6] Fixes for nv command handling Enrico Jorns
2017-11-01  7:27 ` [PATCH 1/6] commands: nv: fail with verbose message if invoked without args Enrico Jorns
2017-11-01  7:27 ` [PATCH 2/6] commands: nv: call nvvar_print() only if no argument is given Enrico Jorns
2017-11-01  7:27 ` [PATCH 3/6] commands: nv: assure error code will be returned when an error occurred Enrico Jorns
2017-11-01  7:27 ` Enrico Jorns [this message]
2017-11-01  7:27 ` [PATCH 5/6] commands: nv: adjust command help Enrico Jorns
2017-11-01  7:27 ` [PATCH 6/6] command: nv: rewrap help text lines Enrico Jorns
2017-11-03  7:51 ` [PATCH v3 0/6] Fixes for nv command handling Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171101072710.31518-5-ejo@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox