* [PATCH] btrfsck open_ctree sanity check
@ 2008-11-15 11:29 hyl
0 siblings, 0 replies; only message in thread
From: hyl @ 2008-11-15 11:29 UTC (permalink / raw)
To: linux-btrfs
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-15 11:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 11:29 [PATCH] btrfsck open_ctree sanity check hyl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox