diff options
author | David Sterba <dsterba@suse.com> | 2016-10-31 10:27:25 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-09 13:47:28 +0100 |
commit | f2744dbc936b844702ae61254a0fb7470fb5b02d (patch) | |
tree | e067a2e5867b9e7fe45671eca8e95f09046ec43d /cmds-qgroup.c | |
parent | 4dc315e68a6f076395b8d3d5a0209f4ff13dd4b7 (diff) |
btrfs-progs: qgroups show: handle errors when resolving root id
If btrfs_get_path_rootid fails, prints an error message but continues.
Replace with a helper that returns an error.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-qgroup.c')
-rw-r--r-- | cmds-qgroup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 98149410..7c5532c4 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -366,7 +366,13 @@ static int cmd_qgroup_show(int argc, char **argv) } if (filter_flag) { - qgroupid = btrfs_get_path_rootid(fd); + ret = lookup_ino_rootid(fd, &qgroupid); + if (ret < 0) { + error("cannot resolve rootid for %s: %s", + path, strerror(-ret)); + close_file_or_dir(fd, dirstream); + goto out; + } if (filter_flag & 0x1) btrfs_qgroup_setup_filter(&filter_set, BTRFS_QGROUP_FILTER_ALL_PARENT, @@ -382,6 +388,7 @@ static int cmd_qgroup_show(int argc, char **argv) if (ret < 0) error("can't list qgroups: %s", strerror(e)); +out: return !!ret; } |