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>
This commit is contained in:
David Sterba 2024-02-20 12:40:48 +01:00
parent 3fbcce4544
commit 9b5f104558
3 changed files with 3 additions and 7 deletions

View file

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

View file

@ -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;
}

View file

@ -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;
}