[PATCH 1/3] mkfs.ubifs: check output first

Shevchenko Andriy (EXT-Teleca/Helsinki) ext-andriy.shevchenko at nokia.com
Thu Jun 17 04:42:37 EDT 2010


Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko at nokia.com>
---
 mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index e4b4e3c..9061453 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -647,8 +647,11 @@ static int get_options(int argc, char**argv)
 
 	if (optind != argc && !output)
 		output = strdup(argv[optind]);
-	if (output)
-		out_ubi = !open_ubi(output);
+
+	if (!output)
+		return err_msg("not output device or file specified");
+
+	out_ubi = !open_ubi(output);
 
 	if (out_ubi) {
 		c->min_io_size = c->di.min_io_size;
@@ -656,9 +659,6 @@ static int get_options(int argc, char**argv)
 		c->max_leb_cnt = c->vi.rsvd_lebs;
 	}
 
-	if (!output)
-		return err_msg("not output device or file specified");
-
 	if (c->min_io_size == -1)
 		return err_msg("min. I/O unit was not specified "
 			       "(use -h for help)");
-- 
1.6.3.3




More information about the linux-mtd mailing list