summaryrefslogtreecommitdiff
path: root/cmds-inspect.c
diff options
context:
space:
mode:
authorMisono, Tomohiro <misono.tomohiro@jp.fujitsu.com>2017-09-04 14:05:34 +0900
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit88ef0b8397fa13f6114dc3ba5c8e88a7b7c992f9 (patch)
tree88ba31470ec21ef5884be89522cdbd5b00d93f92 /cmds-inspect.c
parentf47587d83db2fd7beaf1ceb9feb8c3e16e2b352c (diff)
btrfs-progs: inspect rootid: Allow a file to be specified
Since cmd_inspect_rootid() calls btrfs_open_dir(), it rejects a file to be specified. But as the document says, a file should be supported. This patch introduces btrfs_open_file_or_dir(), which is a counterpart of btrfs_open_dir(), to safely check and open btrfs file or directory. The original btrfs_open_dir() content is moved to btrfs_open() and shared by both function. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-inspect.c')
-rw-r--r--cmds-inspect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-inspect.c b/cmds-inspect.c
index d1a3a0e..885f3ab 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -318,7 +318,7 @@ static int cmd_inspect_rootid(int argc, char **argv)
if (check_argc_exact(argc - optind, 1))
usage(cmd_inspect_rootid_usage);
- fd = btrfs_open_dir(argv[optind], &dirstream, 1);
+ fd = btrfs_open_file_or_dir(argv[optind], &dirstream, 1);
if (fd < 0) {
ret = -ENOENT;
goto out;