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

login
register
mail settings
Submitter Shevchenko Andriy (EXT-Teleca/Helsinki)
Date June 17, 2010, 8:42 a.m.
Message ID <1276764159-28726-1-git-send-email-ext-andriy.shevchenko@nokia.com>
Download mbox | patch
Permalink /patch/56406/
State Accepted
Commit 1a48432ba8ae05af773e4a4cc006c8a611fbee8f
Headers show

Comments

Shevchenko Andriy (EXT-Teleca/Helsinki) - June 17, 2010, 8:42 a.m.
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Patch

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)");