From patchwork Sun Aug 28 11:23:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 1105512 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7SBKQWa027681 for ; Sun, 28 Aug 2011 11:20:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821Ab1H1LUW (ORCPT ); Sun, 28 Aug 2011 07:20:22 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:33254 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766Ab1H1LUW (ORCPT ); Sun, 28 Aug 2011 07:20:22 -0400 Received: from sf.home (unknown [178.125.138.26]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: slyfox) by smtp.gentoo.org (Postfix) with ESMTPSA id 9D9021B409D; Sun, 28 Aug 2011 11:20:21 +0000 (UTC) Received: by sf.home (Postfix, from userid 1000) id BE1CC799021; Sun, 28 Aug 2011 14:23:37 +0300 (EEST) From: slyich@gmail.com To: linux-btrfs@vger.kernel.org Cc: Sergei Trofimovich Subject: [PATCH] btrfsck: decode error properly Date: Sun, 28 Aug 2011 14:23:24 +0300 Message-Id: <1314530604-27245-1-git-send-email-slyich@gmail.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 28 Aug 2011 11:20:37 +0000 (UTC) From: Sergei Trofimovich check_mounted() returns kernel-style negative errors. Patch drops sign for strerror(). Before the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Unknown error 18446744073709551603 After the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Permission denied Signed-off-by: Sergei Trofimovich --- btrfs-select-super.c | 2 +- btrfs-zero-log.c | 2 +- btrfsck.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/btrfs-select-super.c b/btrfs-select-super.c index f12f36c..51eb9c9 100644 --- a/btrfs-select-super.c +++ b/btrfs-select-super.c @@ -75,7 +75,7 @@ int main(int ac, char **av) radix_tree_init(); if((ret = check_mounted(av[optind])) < 0) { - fprintf(stderr, "Could not check mount status: %s\n", strerror(ret)); + fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret)); return ret; } else if(ret) { fprintf(stderr, "%s is currently mounted. Aborting.\n", av[optind]); diff --git a/btrfs-zero-log.c b/btrfs-zero-log.c index f10438b..54d7858 100644 --- a/btrfs-zero-log.c +++ b/btrfs-zero-log.c @@ -50,7 +50,7 @@ int main(int ac, char **av) radix_tree_init(); if((ret = check_mounted(av[1])) < 0) { - fprintf(stderr, "Could not check mount status: %s\n", strerror(ret)); + fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret)); return ret; } else if(ret) { fprintf(stderr, "%s is currently mounted. Aborting.\n", av[1]); diff --git a/btrfsck.c b/btrfsck.c index fc2ac88..3a23e66 100644 --- a/btrfsck.c +++ b/btrfsck.c @@ -2838,7 +2838,7 @@ int main(int ac, char **av) cache_tree_init(&root_cache); if((ret = check_mounted(av[optind])) < 0) { - fprintf(stderr, "Could not check mount status: %s\n", strerror(ret)); + fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret)); return ret; } else if(ret) { fprintf(stderr, "%s is currently mounted. Aborting.\n", av[optind]);