common, ubi: use positive return values for ubi check
PATCH 1/1 common, ubi: use positive return values for ubi check
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(-)
common/cmd_ubi.c +1 -1
@@ -114,7 +114,7 @@ static int ubi_check(char *name)return 0 ; } -return -EEXIST ; +return 1 ; }
Signature · 1 line
2.3.5
PATCH 1/1 common, ubi: use positive return values for ubi check
Quoted 8 lines · Stefan Agner
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!
Signature · 8 lines
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>