From patchwork Wed Jul 25 08:20:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10543673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E36E9093 for ; Wed, 25 Jul 2018 08:17:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E8D029B0F for ; Wed, 25 Jul 2018 08:17:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52C1C29B0B; Wed, 25 Jul 2018 08:17:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED11129B0F for ; Wed, 25 Jul 2018 08:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728647AbeGYJ1j (ORCPT ); Wed, 25 Jul 2018 05:27:39 -0400 Received: from mgwym03.jp.fujitsu.com ([211.128.242.42]:51273 "EHLO mgwym03.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728627AbeGYJ1i (ORCPT ); Wed, 25 Jul 2018 05:27:38 -0400 Received: from yt-mxauth.gw.nic.fujitsu.com (unknown [192.168.229.68]) by mgwym03.jp.fujitsu.com with smtp id 47fb_75c2_2fd612b1_4406_4a3d_b1c6_df86fae87b29; Wed, 25 Jul 2018 17:17:01 +0900 Received: from g01jpfmpwyt03.exch.g01.fujitsu.local (g01jpfmpwyt03.exch.g01.fujitsu.local [10.128.193.57]) by yt-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id EBCF5AC00AF for ; Wed, 25 Jul 2018 17:17:00 +0900 (JST) Received: from g01jpexchyt33.g01.fujitsu.local (unknown [10.128.193.4]) by g01jpfmpwyt03.exch.g01.fujitsu.local (Postfix) with ESMTP id 2450246E839 for ; Wed, 25 Jul 2018 17:17:00 +0900 (JST) Received: from luna3.soft.fujitsu.com (10.124.196.199) by g01jpexchyt33.g01.fujitsu.local (10.128.193.36) with Microsoft SMTP Server id 14.3.352.0; Wed, 25 Jul 2018 17:16:59 +0900 From: Misono Tomohiro To: Subject: [PATCH 1/3] btrfs-progs: ins: logical-resolve: Set correct error value Date: Wed, 25 Jul 2018 17:20:16 +0900 Message-ID: <1447450b84429a439316493340c0c82a605f6539.1532501096.git.misono.tomohiro@jp.fujitsu.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: References: MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reset ret value to zero after snprintf(), which returns the number of written chars. Otherwise non-zero value returns after command success with -P option. Also set return value from __ino_to_path_fd() to reflect the final status for default behavior. Signed-off-by: Misono Tomohiro --- cmds-inspect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmds-inspect.c b/cmds-inspect.c index 2fc50c1a..ac77a5ee 100644 --- a/cmds-inspect.c +++ b/cmds-inspect.c @@ -211,6 +211,7 @@ static int cmd_inspect_logical_resolve(int argc, char **argv) error("path buffer too small: %d bytes", bytes_left); goto out; } + ret = 0; for (i = 0; i < inodes->elem_cnt; i += 3) { u64 inum = inodes->val[i]; @@ -245,7 +246,8 @@ static int cmd_inspect_logical_resolve(int argc, char **argv) goto out; } } - __ino_to_path_fd(inum, path_fd, verbose, full_path); + ret = __ino_to_path_fd(inum, path_fd, verbose, + full_path); if (path_fd != fd) close_file_or_dir(path_fd, dirs); } else {