From 26ab531523a319682a099c9a91aa3b8aeab2835c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 29 May 2000 15:05:42 +0000 Subject: [PATCH] ChangeLog, mke2fs.c: mke2fs.c (PRS): Add a much more specific error message if the filesystem size is defaulted and get_device_size returns a size of zero. Otherwise, users get a confusing "invalid argument while passed to ext2 library" error message. --- misc/ChangeLog | 7 +++++++ misc/mke2fs.c | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index f9fc009..44062ef 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,10 @@ +2000-05-29 Theodore Ts'o + + * mke2fs.c (PRS): Add a much more specific error message if the + filesystem size is defaulted and get_device_size returns a + size of zero. Otherwise, users get a confusing "invalid + argument while passed to ext2 library" error message. + 2000-05-08 Theodore Ts'o * fsck.c (interpret_device): Add better error messages if a UUID= diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 3026f4c..5d012c1 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -949,8 +949,22 @@ static void PRS(int argc, char *argv[]) "must specify\nthe size of the " "filesystem\n")); exit(1); - } else + } else { + if (dev_size == 0) { + com_err(program_name, 0, + _("Device size reported to be zero. " + "Invalid partition specified, or\n\t" + "partition table wasn't reread " + "after running fdisk, due to\n\t" + "a modified partition being busy " + "and in use. You may need to reboot\n\t" + "to re-read your partition table.\n" + )); + exit(1); + } param.s_blocks_count = dev_size; + } + } else if (!force && (param.s_blocks_count > dev_size)) { com_err(program_name, 0, _("Filesystem larger than apparent filesystem size.")); -- 1.8.3.1