From patchwork Wed Sep 25 12:13:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11160561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0B75912 for ; Wed, 25 Sep 2019 12:14:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8EBD217F4 for ; Wed, 25 Sep 2019 12:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405479AbfIYMOF (ORCPT ); Wed, 25 Sep 2019 08:14:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:59706 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405211AbfIYMOE (ORCPT ); Wed, 25 Sep 2019 08:14:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 47728ABCE for ; Wed, 25 Sep 2019 12:14:03 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v3 02/10] btrfs-progs: image: Fix error output to show correct return value Date: Wed, 25 Sep 2019 20:13:48 +0800 Message-Id: <20190925121356.118038-3-wqu@suse.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925121356.118038-1-wqu@suse.com> References: <20190925121356.118038-1-wqu@suse.com> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We can easily get confusing error message like: ERROR: restore failed: Success This is caused by wrong "%m" usage, as we normally use ret to indicate error, without populating errno. This patch will fix it by output the return value directly as normally we have extra error message to show more meaning message than the return value. Signed-off-by: Qu Wenruo --- image/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/main.c b/image/main.c index fb407f33f858..7c499c0853d0 100644 --- a/image/main.c +++ b/image/main.c @@ -2734,7 +2734,7 @@ int BOX_MAIN(image)(int argc, char *argv[]) 0, target, multi_devices); } if (ret) { - error("%s failed: %m", (create) ? "create" : "restore"); + error("%s failed: %d", (create) ? "create" : "restore", ret); goto out; }