All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common, ubi: use positive return values for ubi check
@ 2015-04-10  9:25 Stefan Agner
  2015-04-10 18:49 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Agner @ 2015-04-10  9:25 UTC (permalink / raw)
  To: u-boot

The ubi check command is expected to not fail and just check whether
a volume exist or not. Currently, when a volume does not exist, the
command fails which leads to an error:
"exit not allowed from main input shell."

Use 1 to indicate that a volume does not exist. This allows to use
ubi check in an if statement, e.g.
if ubi check rootfs; then; echo "exists"; else; echo "not there"; fi
---
 common/cmd_ubi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 6c85703..cbc10c5 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -114,7 +114,7 @@ static int ubi_check(char *name)
 			return 0;
 	}
 
-	return -EEXIST;
+	return 1;
 }
 
 
-- 
2.3.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] common, ubi: use positive return values for ubi check
  2015-04-10  9:25 [U-Boot] [PATCH] common, ubi: use positive return values for ubi check Stefan Agner
@ 2015-04-10 18:49 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2015-04-10 18:49 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 10, 2015 at 11:25:43AM +0200, Stefan Agner wrote:

> The ubi check command is expected to not fail and just check whether
> a volume exist or not. Currently, when a volume does not exist, the
> command fails which leads to an error:
> "exit not allowed from main input shell."
> 
> Use 1 to indicate that a volume does not exist. This allows to use
> ubi check in an if statement, e.g.
> if ubi check rootfs; then; echo "exists"; else; echo "not there"; fi

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150410/c7cbf3a8/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-10 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10  9:25 [U-Boot] [PATCH] common, ubi: use positive return values for ubi check Stefan Agner
2015-04-10 18:49 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.