btrfsprogs/0133-Btrfs-progs-check-return-value-properly.patch

32 lines
1003 B
Diff

From 4686f96637316b509cb16c657b73b40a329be6db Mon Sep 17 00:00:00 2001
From: Josef Bacik <josef@redhat.com>
Date: Thu, 8 Dec 2011 17:24:54 -0500
Subject: [PATCH 34/35] 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 <josef@redhat.com>
---
restore.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/restore.c b/restore.c
index 90d54e4..398c49a 100644
--- a/restore.c
+++ b/restore.c
@@ -831,8 +831,8 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, int super_
key.offset = (u64)-1;
root->fs_info->fs_root = btrfs_read_fs_root(root->fs_info, &key);
- if (!root->fs_info->fs_root) {
- fprintf(stderr, "Couldn't read fs_root\n");
+ if (IS_ERR(root->fs_info->fs_root)) {
+ fprintf(stderr, "Couldn't read fs_root: %d\n", PTR_ERR(root));
close_ctree(root);
return NULL;
}
--
1.7.6.233.gd79bc