Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 105d736c57b2691635bd047efe146ef0 > files > 9

btrfs-progs-0.20-0.rc1.20130117.2.mga3.src.rpm

From 680a80ece109a2994ac9c59511fb8974ace12fd9 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Tue, 29 Jan 2013 14:32:28 -0600
Subject: [PATCH] btrfs-progs: fix mkfs.btrfs -r option

Commit 605e806166847872bb91831b397d58f95027975a broke the
mkfs.btrfs -r option, because it calls make_btrfs
without ever setting dev_block_count, in the -r case,
so we tell it to make a filesystem of size 0.

Then we wander into ENOSPC land and segfault.

As a quick one-line-fix, just set the dev_block_count
to the size of the destination image file.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 mkfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mkfs.c b/mkfs.c
index a129ec4..e46f155 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1384,6 +1384,8 @@ int main(int ac, char **av)
 			fprintf(stderr, "unable to zero the output file\n");
 			exit(1);
 		}
+		/* our "device" is the new image file */
+		dev_block_count = block_count;
 	}
 
 	ssd = is_ssd(file);
-- 
1.8.1.5