xfs
[Top] [All Lists]

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

To: xfs mailing list <xfs@xxxxxxxxxxx>
Subject: [PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 14 Jan 2010 15:53:52 -0600
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
# /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@xxxxxxxxxxx>
---

(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;

<Prev in Thread] Current Thread [Next in Thread>