summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Kario <kario@wit.edu.pl>2012-02-19 21:11:46 +0100
committerChris Mason <chris.mason@fusionio.com>2012-07-03 16:27:46 -0400
commitff2b80b460bbb5ff85f543661be218ffab0e286b (patch)
treee6d84b1aff1c2e26a721e727b58cdfa09d7884c6
parent3f388b9690a3040139f4f899118e0701073de0c7 (diff)
Fix segmentation fault when opening invalid file system
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
-rw-r--r--btrfslabel.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/btrfslabel.c b/btrfslabel.c
index da694e1d..bf738024 100644
--- a/btrfslabel.c
+++ b/btrfslabel.c
@@ -55,6 +55,8 @@ static void change_label_unmounted(char *dev, char *nLabel)
* and as read-write.
*/
root = open_ctree(dev, 0, 1);
+ if (!root) /* errors are printed by open_ctree() */
+ return;
trans = btrfs_start_transaction(root, 1);
strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);