i.e Permission denied, open_ctree will return NULL, then lead
to a segment fault later.
Signed-off-by Yongli He <heyongli@gmail.com>
---
btrfsck.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/btrfsck.c b/btrfsck.c
index 801249b..86c2eeb 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -770,6 +770,11 @@ int main(int ac, char **av) {
cache_tree_init(&reada);
root = open_ctree(av[1], 0, 0);
+ if(!root){
+ perror("open");
+ exit(1);
+ }
+
bits_nr = 1024;
bits = malloc(bits_nr * sizeof(struct block_info));
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html