diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-10-12 21:23:04 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-11-02 09:35:02 +0100 |
commit | 14ac9851462c29f3f97355df5b4c3c9f1953c043 (patch) | |
tree | 2cb62539b0eb9a368cc5d0508a06b65b86319155 /btrfs-fragments.c | |
parent | 0b4e2d0c8a02e3eaaeca47bb306692ab76a0a200 (diff) |
btrfs-progs: fragments: use btrfs_open_dir for btrfs-fragments command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
deeper code, and return fuzzy error message.
Before patch:
./btrfs-fragments -o 123 /mnt/tmp1
ERROR: can't perform the search
After patch:
# ./btrfs-fragments -o 123 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-fragments.c')
-rw-r--r-- | btrfs-fragments.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/btrfs-fragments.c b/btrfs-fragments.c index d742f605..17768c3f 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c @@ -436,11 +436,9 @@ int main(int argc, char **argv) path = argv[optind++]; - fd = open_file_or_dir(path, &dirstream); - if (fd < 0) { - fprintf(stderr, "ERROR: can't access '%s'\n", path); + fd = btrfs_open_dir(path, &dirstream, 1); + if (fd < 0) exit(1); - } if (flags == 0) flags = BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA; |