linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] btrfs-progs: remove variable e from cmd_inspect_list_chunks()
Date: Thu, 28 Sep 2023 13:36:33 +0930	[thread overview]
Message-ID: <c01c5f2ec4a967a893f754870df436e01b6525c8.1695873867.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1695873867.git.wqu@suse.com>

The variable @e is only utilized to record the errno from ioctl() call,
and is only for the error message.

We can go with "%m" to replace the usage of variable @e, and remove the
variable shadowing, as later we will declare a local variable @e with a
different type.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 cmds/inspect.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cmds/inspect.c b/cmds/inspect.c
index ef928895fa08..50f1ddc745a6 100644
--- a/cmds/inspect.c
+++ b/cmds/inspect.c
@@ -1026,7 +1026,6 @@ static int cmd_inspect_list_chunks(const struct cmd_struct *cmd,
 	int ret;
 	int fd;
 	int i;
-	int e;
 	DIR *dirstream = NULL;
 	unsigned unit_mode;
 	char *sortmode = NULL;
@@ -1114,9 +1113,8 @@ static int cmd_inspect_list_chunks(const struct cmd_struct *cmd,
 	while (1) {
 		sk->nr_items = 1;
 		ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
-		e = errno;
 		if (ret < 0) {
-			error("cannot perform the search: %s", strerror(e));
+			error("cannot perform the search: %m");
 			return 1;
 		}
 		if (sk->nr_items == 0)
-- 
2.42.0


  reply	other threads:[~2023-09-28  4:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  4:06 [PATCH 0/2] btrfs-progs: -Wshadow fixes Qu Wenruo
2023-09-28  4:06 ` Qu Wenruo [this message]
2023-09-28  4:06 ` [PATCH 2/2] btrfs-progs: fix a variable shadowing when enabling experimental features Qu Wenruo
2023-10-02 15:17 ` [PATCH 0/2] btrfs-progs: -Wshadow fixes David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c01c5f2ec4a967a893f754870df436e01b6525c8.1695873867.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).