From af250420caf71a4d787891d8ae49f56299a01201 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 21 Jan 2009 13:59:36 -0500 Subject: btrfsck: Exit and print error message when not able to open a device If btrfsck is not able to open a device, it segfaults. This fixes it and prints an error message too. --- disk-io.c | 1 + 1 file changed, 1 insertion(+) (limited to 'disk-io.c') diff --git a/disk-io.c b/disk-io.c index c15cf53e..e49c220d 100644 --- a/disk-io.c +++ b/disk-io.c @@ -530,6 +530,7 @@ struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr, int writes) fp = open(filename, flags, 0600); if (fp < 0) { + fprintf (stderr, "Coult not open %s\n", filename); return NULL; } root = open_ctree_fd(fp, filename, sb_bytenr, writes); -- cgit v1.2.3