From b808cb66aa7e68bfadfc73f8e5191d284413e3d1 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 25 Feb 2013 16:54:37 -0600 Subject: 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 --- cmds-subvolume.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cmds-subvolume.c') 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; } -- cgit v1.2.3