From c94965198a8da394b1f87e4fdb4cdc4bcd2adf9b Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Thu, 28 Sep 2023 13:36:33 +0930 Subject: [PATCH] btrfs-progs: replace errno with %m in cmd_inspect_list_chunks() 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 Signed-off-by: David Sterba --- cmds/inspect.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmds/inspect.c b/cmds/inspect.c index eb51f273..8f54dc3f 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -1023,7 +1023,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; @@ -1111,9 +1110,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)