From patchwork Mon Apr 4 08:21:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shevchenko Andriy (EXT-Teleca/Helsinki)" X-Patchwork-Id: 89596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 68998B6F1E for ; Mon, 4 Apr 2011 18:22:32 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q6f1q-0001NH-NI; Mon, 04 Apr 2011 08:20:54 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q6f1p-0008VT-6i; Mon, 04 Apr 2011 08:20:53 +0000 Received: from smtp.nokia.com ([147.243.128.26] helo=mgw-da02.nokia.com) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q6f1i-0008VC-Fv for linux-mtd@lists.infradead.org; Mon, 04 Apr 2011 08:20:50 +0000 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p348Kh1c023896 for ; Mon, 4 Apr 2011 11:20:43 +0300 Received: from fs-test.research.nokia.com ([esdhcp05135.research.nokia.com [172.21.51.35]]) by mgw-da02.nokia.com with ESMTP id p348KcfD023817 ; Mon, 4 Apr 2011 11:20:39 +0300 Received: by fs-test.research.nokia.com (Postfix, from userid 1001) id 99F73CF9C6; Mon, 4 Apr 2011 11:21:16 +0300 (EEST) From: Andy Shevchenko To: linux-mtd@lists.infradead.org, "Bityutskiy Artem (Nokia-MS/Helsinki)" Subject: [PATCH] mkfs.ubifs: check output first Date: Mon, 4 Apr 2011 11:21:15 +0300 Message-Id: <1301905275-2087-1-git-send-email-ext-andriy.shevchenko@nokia.com> X-Mailer: git-send-email 1.6.3.3 X-Nokia-AV: Clean X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110404_042046_681267_AB0CE505 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_SPACE_BRACKET TVD_RCVD_SPACE_BRACKET -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [147.243.128.26 listed in list.dnswl.org] Cc: Andy Shevchenko X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Andy Shevchenko --- 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)");