mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! commands: implement new devlookup command
Date: Thu, 30 Jun 2022 15:26:36 +0200	[thread overview]
Message-ID: <20220630132636.4040435-1-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220630124035.4019644-3-a.fatoum@pengutronix.de>

Propagate error correctly when writing into environment variable as
well. While at it, ensure we do return an error value.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/devlookup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commands/devlookup.c b/commands/devlookup.c
index 9599df7b10bc..ce4cf2e10f45 100644
--- a/commands/devlookup.c
+++ b/commands/devlookup.c
@@ -11,12 +11,12 @@
 
 static int report(const char *variable, const char *val)
 {
+	if (!val)
+		return -(errno ?: EINVAL);
+
 	if (variable)
 		return setenv(variable, val);
 
-	if (!val)
-		return -errno;
-
 	printf("%s\n", val);
 	return 0;
 }
-- 
2.30.2




      reply	other threads:[~2022-06-30 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 12:40 [PATCH 1/3] partitions: efi: register guid device parameter for disk GUID Ahmad Fatoum
2022-06-30 12:40 ` [PATCH 2/3] commands: implement devlookup to find device behind device file Ahmad Fatoum
2022-06-30 15:26   ` Michael Olbrich
2022-07-01  5:24     ` Ahmad Fatoum
2022-07-05  7:45   ` Sascha Hauer
2022-07-05  7:48     ` Ahmad Fatoum
2022-06-30 12:40 ` [PATCH 3/3] block: efi: allow disabling /dev/usbdiskX renaming Ahmad Fatoum
2022-06-30 13:26   ` Ahmad Fatoum [this message]

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=20220630132636.4040435-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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