aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2024-02-20 12:40:48 +0100
committerDavid Sterba <dsterba@suse.com>2024-02-20 12:47:39 +0100
commit9b5f10455854936013c1550a2cd424f8d5868d0a (patch)
tree8f25af6f2463f3469085d478802ea95e95969e76
parent3fbcce45446a45c47a83ba6398e355bb1d2f8f03 (diff)
downloadbtrfs-progs-9b5f10455854936013c1550a2cd424f8d5868d0a.tar.gz
btrfs-progs: always print error messages from btrfs_open_fd2()
There are some cases that disable verbosity (of errors) and then print own message. Enable the verbose error messages printed by btrfs_open_fd2() as they are specific. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds/filesystem-du.c2
-rw-r--r--cmds/filesystem.c4
-rw-r--r--cmds/property.c4
3 files changed, 3 insertions, 7 deletions
diff --git a/cmds/filesystem-du.c b/cmds/filesystem-du.c
index 32815855..32ab1059 100644
--- a/cmds/filesystem-du.c
+++ b/cmds/filesystem-du.c
@@ -456,7 +456,7 @@ static int du_add_file(const char *filename, int dirfd,
ret = sprintf(pathp, "/%s", filename);
pathp += ret;
- fd = btrfs_open_fd2(path, false, false, false);
+ fd = btrfs_open_fd2(path, true, false, false);
if (fd < 0) {
ret = fd;
goto out;
diff --git a/cmds/filesystem.c b/cmds/filesystem.c
index 8005980e..4d325fa2 100644
--- a/cmds/filesystem.c
+++ b/cmds/filesystem.c
@@ -1150,10 +1150,8 @@ static int cmd_filesystem_defrag(const struct cmd_struct *cmd,
struct stat st;
int defrag_err = 0;
- fd = btrfs_open_fd2(argv[i], false, defrag_open_mode == O_RDWR, false);
+ fd = btrfs_open_fd2(argv[i], true, defrag_open_mode == O_RDWR, false);
if (fd < 0) {
- errno = -fd;
- error("cannot open %s: %m", argv[i]);
ret = fd;
goto next;
}
diff --git a/cmds/property.c b/cmds/property.c
index 0121b4d5..0afd6030 100644
--- a/cmds/property.c
+++ b/cmds/property.c
@@ -179,10 +179,8 @@ static int prop_compression(enum prop_object_type type,
char *xattr_name = NULL;
int open_flags = value ? O_RDWR : O_RDONLY;
- fd = btrfs_open_fd2(object, false, open_flags == O_RDWR, false);
+ fd = btrfs_open_fd2(object, true, open_flags == O_RDWR, false);
if (fd < 0) {
- errno = -fd;
- error("failed to open %s: %m", object);
ret = fd;
goto out;
}