Skip to contentSkip to conversation

btrfsck open_ctree sanity check

PATCH New hyl 1 participant 1 message Nov 15, 2008 Btrfs file system

lore
Share & tools
lore

hyl

author
#0 lore raw

PATCH 1/1 btrfsck open_ctree sanity check

i.e Permission denied, open_ctree will return NULL, then lead to a segment fault later.

Signed-off-by Yongli He <[email protected]>

---
 btrfsck.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
btrfsck.c +5 -0
index 801249b..86c2eeb 100644
@@ -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));
Signature · 1 line
1.5.4.3