[PATCH] mkfs.ubifs: check output first

Andy Shevchenko ext-andriy.shevchenko at nokia.com
Mon Apr 4 04:21:15 EDT 2011


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 bc0817f..9f3c5e0 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -675,8 +675,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;
@@ -684,9 +687,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