summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-02-25 16:54:37 -0600
committerDavid Sterba <dsterba@suse.cz>2013-02-27 14:39:27 +0100
commitb808cb66aa7e68bfadfc73f8e5191d284413e3d1 (patch)
tree136f0261e5fa4e49eaefb2fb1115a574ce8a461f /cmds-subvolume.c
parentb26746e462b67e4310cf88289703a74c3a213d14 (diff)
btrfs-progs: btrfs_list_get_path_rootid error handling
btrfs_list_get_path_rootid() tries to return a negative number on error, but it's a u64 function. Callers which test for a return < 0 will never see an error. Change the function to fill in the rootid via a pointer, and then return a simple int as error. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index ea128fce..f9258fcb 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -433,7 +433,11 @@ static int cmd_subvol_list(int argc, char **argv)
goto out;
}
- top_id = btrfs_list_get_path_rootid(fd);
+ ret = btrfs_list_get_path_rootid(fd, &top_id);
+ if (ret) {
+ fprintf(stderr, "ERROR: can't get rootid for '%s'\n", subvol);
+ goto out;
+ }
if (is_list_all)
btrfs_list_setup_filter(&filter_set,
@@ -821,8 +825,8 @@ static int cmd_subvol_show(int argc, char **argv)
goto out;
}
- sv_id = btrfs_list_get_path_rootid(fd);
- if (sv_id < 0) {
+ ret = btrfs_list_get_path_rootid(fd, &sv_id);
+ if (ret) {
fprintf(stderr, "ERROR: can't get rootid for '%s'\n",
fullpath);
goto out;
@@ -834,8 +838,8 @@ static int cmd_subvol_show(int argc, char **argv)
goto out;
}
- mntid = btrfs_list_get_path_rootid(mntfd);
- if (mntid < 0) {
+ ret = btrfs_list_get_path_rootid(mntfd, &mntid);
+ if (ret) {
fprintf(stderr, "ERROR: can't get rootid for '%s'\n", mnt);
goto out;
}