[PATCH] ubinfo: Fix --vol_id return code for absent volume id

Andrew Mellor andrew.mellor at casa-systems.com
Sun Jun 5 23:38:46 PDT 2022


When using --vol_id and that volume is missing, it should return
non-zero like the --name option does.

Signed-off-by: Andrew Mellor <andrew.mellor at casa-systems.com>
---
 ubi-utils/ubinfo.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c
index 29530be..53519cc 100644
--- a/ubi-utils/ubinfo.c
+++ b/ubi-utils/ubinfo.c
@@ -417,12 +417,9 @@ int main(int argc, char * const argv[])
 		goto out_libubi;
 	}
 
-	if (args.devn != -1 && args.vol_id != -1) {
-		print_vol_info(libubi, args.devn, args.vol_id);
-		goto out;
-	}
-
-	if (args.devn == -1 && args.vol_id == -1)
+	if (args.devn != -1 && args.vol_id != -1)
+		err = print_vol_info(libubi, args.devn, args.vol_id);
+	else if (args.devn == -1 && args.vol_id == -1)
 		err = print_general_info(libubi, args.all);
 	else if (args.devn != -1 && args.vol_id == -1)
 		err = print_dev_info(libubi, args.devn, args.all);
-- 
2.36.1




More information about the linux-mtd mailing list