This fix makes mkfs.minix also to warn if block is misaligned. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- disk-utils/mkfs.minix.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index f2a442e..5c94fbf 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -819,14 +819,11 @@ int main(int argc, char ** argv) if (is_mounted(ctl.device_name)) errx(MKFS_EX_ERROR, _("%s is mounted; will not make a filesystem here!"), ctl.device_name); - if (stat(ctl.device_name, &statbuf) < 0) - err(MKFS_EX_ERROR, _("stat of %s failed"), ctl.device_name); - if (S_ISBLK(statbuf.st_mode)) - ctl.device_fd = open(ctl.device_name, O_RDWR | O_EXCL); - else - ctl.device_fd = open(ctl.device_name, O_RDWR); + ctl.device_fd = open_blkdev_or_file(ctl.device_name, O_RDWR); if (ctl.device_fd < 0) err(MKFS_EX_ERROR, _("cannot open %s"), ctl.device_name); + if (fstat(ctl.device_fd, &statbuf) < 0) + err(MKFS_EX_ERROR, _("stat of %s failed"), ctl.device_name); determine_device_blocks(&ctl, &statbuf); setup_tables(&ctl); if (ctl.check_blocks) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html