Skip to content

Commit 4686f96

Browse files
author
Josef Bacik
committed
Btrfs-progs: check return value properly
We were checking for a null root coming back from btrfs_read_fs_root but thats not right since it returns a ERR_PTR. Thanks, Signed-off-by: Josef Bacik <[email protected]>
1 parent df8b44a commit 4686f96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

restore.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, int super_
831831
key.offset = (u64)-1;
832832

833833
root->fs_info->fs_root = btrfs_read_fs_root(root->fs_info, &key);
834-
if (!root->fs_info->fs_root) {
835-
fprintf(stderr, "Couldn't read fs_root\n");
834+
if (IS_ERR(root->fs_info->fs_root)) {
835+
fprintf(stderr, "Couldn't read fs_root: %d\n", PTR_ERR(root));
836836
close_ctree(root);
837837
return NULL;
838838
}

0 commit comments

Comments
 (0)