From patchwork Thu Jun 19 01:27:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 4380201 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7E6DBBEEAA for ; Thu, 19 Jun 2014 01:32:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB0462038C for ; Thu, 19 Jun 2014 01:32:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECD3820380 for ; Thu, 19 Jun 2014 01:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756891AbaFSBcA (ORCPT ); Wed, 18 Jun 2014 21:32:00 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:1557 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755962AbaFSBb6 (ORCPT ); Wed, 18 Jun 2014 21:31:58 -0400 X-IronPort-AV: E=Sophos;i="5.00,735,1396972800"; d="scan'208";a="32121228" Received: from localhost (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 19 Jun 2014 09:28:42 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s5J1VKhK019659 for ; Thu, 19 Jun 2014 09:31:20 +0800 Received: from wangs.fnst.cn.fujitsu.com (10.167.226.104) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 19 Jun 2014 09:31:20 +0800 From: Wang Shilong To: Subject: [PATCH 3/6] Btrfs-progs: btrfs-restore, fix wrong return value if it fails to read specified fs root Date: Thu, 19 Jun 2014 09:27:06 +0800 Message-ID: <1403141229-25565-3-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1403141229-25565-1-git-send-email-wangsl.fnst@cn.fujitsu.com> References: <1403141229-25565-1-git-send-email-wangsl.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.104] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Steps to reproduce: # mkfs.btrfs -f /dev/sda9 # btrfs restore -f 1 -o /tmp /dev/sda9 # echo $? Fix to return 1 in this failure path. Signed-off-by: Wang Shilong --- cmds-restore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmds-restore.c b/cmds-restore.c index 934755a..48c46ff 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -1233,6 +1233,7 @@ int cmd_restore(int argc, char **argv) root->node = read_tree_block(root, fs_location, root->leafsize, 0); if (!root->node) { fprintf(stderr, "Failed to read fs location\n"); + ret = 1; goto out; } }