From patchwork Tue Apr 15 09:22:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 3990191 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3C4869F2BA for ; Tue, 15 Apr 2014 09:21:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 765782021F for ; Tue, 15 Apr 2014 09:21:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C00C2020F for ; Tue, 15 Apr 2014 09:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751242AbaDOJVY (ORCPT ); Tue, 15 Apr 2014 05:21:24 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:32256 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750972AbaDOJVW (ORCPT ); Tue, 15 Apr 2014 05:21:22 -0400 X-IronPort-AV: E=Sophos;i="4.97,862,1389715200"; d="scan'208";a="29282474" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 15 Apr 2014 17:18:52 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s3F9LG21011687 for ; Tue, 15 Apr 2014 17:21:18 +0800 Received: from adam-work.lan (10.167.226.24) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Tue, 15 Apr 2014 17:21:24 +0800 From: Qu Wenruo To: Subject: [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file. Date: Tue, 15 Apr 2014 17:22:24 +0800 Message-ID: <1397553744-24465-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 1.9.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 When executing 'btrfs pro get' on a file which is not compressed, return value will always be 50 since prop_compress() return -ENOATTR. But the codes have already check the errno to avoid unnecessary error message, so the return value should also set to 0. Signed-off-by: Qu Wenruo Reviewed-by: Filipe Manana --- props.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/props.c b/props.c index 4d0aeea..c09865b 100644 --- a/props.c +++ b/props.c @@ -142,10 +142,12 @@ static int prop_compression(enum prop_object_type type, sret = fgetxattr(fd, xattr_name, NULL, 0); if (sret < 0) { ret = -errno; - if (ret != -ENODATA) + if (ret != -ENOATTR) fprintf(stderr, "ERROR: failed to %s compression for %s. %s\n", value ? "set" : "get", object, strerror(-ret)); + else + ret = 0; goto out; } if (!value) {