Add const to other copy of check_overwrite Move "no mkfs target" check to a higher, more obvious location Do not truncate file unless it needs to be grown to full fs (as in Jan's v2) Eric Sandeen <sandeen@xxxxxxxxxx>: move check for no mkfs target Eric Sandeen <sandeen@xxxxxxxxxx>: other minor fixes --- diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index ec24884..1643289 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -951,7 +951,7 @@ out_free_probe: access are not working! static int check_overwrite( - char *device) + const char *device) { return 1; } @@ -1037,10 +1037,6 @@ check_device_type( usage(); } - if (name == NULL) { - usage(); - } - if (stat64(name, &statbuf)) { if (errno == ENOENT && *isfile) { if (create) @@ -2218,6 +2214,11 @@ main( } else dfile = xi.dname; + if (!dfile) { + fprintf(stderr, _("no device name given in argument list\n")); + usage(); + } + /* * Blocksize and sectorsize first, other things depend on them * For RAID4/5/6 we want to align sector size and block size, @@ -3127,13 +3128,15 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), /* * If the data area is a file, then grow it out to its final size - * so that the reads for the end of the device in the mount code - * will succeed. + * if needed so that the reads for the end of the device in the mount + * code will succeed. */ - if (xi.disfile && ftruncate64(xi.dfd, dblocks * blocksize) < 0) { - fprintf(stderr, _("%s: Growing the data section failed\n"), - progname); - exit(1); + if (xi.disfile && xi.dsize * xi.dbsize < dblocks * blocksize) { + if (ftruncate64(xi.dfd, dblocks * blocksize) < 0) { + fprintf(stderr, _("%s: Growing the data section failed\n"), + progname); + exit(1); + } } /* _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs