[PATCH] fixup! commands: implement new devlookup command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux