[PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files

Eric Sandeen sandeen at sandeen.net
Thu Jan 14 15:53:52 CST 2010


# /sbin/mkfs.xfs -dfile,name=grrr,size=100g
mkfs.xfs: Use the -f option to force overwrite.

check_overwrite is failing, because  blkid_new_probe_from_filename()
is failing, because the (new) image file is 0 length.

We already return 0 (carry on!) for other internal failures,
and nobody tests for a -1 return.  So let's just let this
one pass too.

Signed-off-by: Eric Sandeen <sandeen at sandeen.net>
---

(note, i'm open to comments if we want to differentiate
1/0/-1 in a cleaner fashion...)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 9a8eff3..53568bc 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -296,7 +296,7 @@ check_overwrite(
 
 	pr = blkid_new_probe_from_filename(device);
 	if (!pr)
-		return -1;
+		return 0;
 
 	if (blkid_probe_enable_partitions(pr, 1))
 		goto out_free_probe;




More information about the xfs mailing list