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 <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2023-09-28 13:36:33 +09:30 committed by David Sterba
parent 553273a834
commit c94965198a

View file

@ -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)