[PATCH 15/19] mkfs: don't treat files as though they are block devices
Eric Sandeen
sandeen at sandeen.net
Fri Apr 8 23:12:12 CDT 2016
On 4/8/16 9:58 AM, Jan Tulak wrote:
> This one causes at least one interesting issue:
>
> #mkfs/mkfs.xfs
> Error accessing specified device (null): Bad address
> Usage: mkfs.xfs
> ...
>
> because:
>
> check_device_type(dfile, &xi.disfile, !dsize, !dfile,
> Nflag ? NULL : &xi.dcreat, force_overwrite, "d");
>
> so "dfile" can be NULL, but that function immediately tries to stat it.
>
>
> A simple if NULL, then usage() should take care of this...
Well, think hard about that. If dfile == NULL and bails with usage(), then
what is the point of having !dfile as a function argument?
Validation of having a target specified as either -dfile= or as the last argument
should probably happen before the call to check_device_type.
-Eric
More information about the xfs
mailing list