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