[PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files
aelder at sgi.com
Fri Jan 15 12:01:56 CST 2010
Eric Sandeen wrote:
> # /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.
I discussed this with Eric. He suggested that instead of
simply ignoring the case of not recognizing the underlying
file system type, we could report that, and then allow the
user to intentionally overwrite it by specifying "-f".
I thought that was a better approach, and he agreed to
re-submit a patch that does that.
> 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;
> xfs mailing list
> xfs at oss.sgi.com
More information about the xfs