diff options
author | Sami Kerola | 2012-10-04 00:14:26 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-15 16:01:42 +0200 |
commit | f150ac37bc60579a4c956470a2fbd797612a20a3 (patch) | |
tree | 25d3ca9e6c6609e4e4be516679d6cba37e5ec47d /disk-utils/mkfs.minix.c | |
parent | pg: check numeric user inputs (diff) | |
download | kernel-qcow2-util-linux-f150ac37bc60579a4c956470a2fbd797612a20a3.tar.gz kernel-qcow2-util-linux-f150ac37bc60579a4c956470a2fbd797612a20a3.tar.xz kernel-qcow2-util-linux-f150ac37bc60579a4c956470a2fbd797612a20a3.zip |
mkfs.minix: check numeric user inputs
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r-- | disk-utils/mkfs.minix.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 49626bf2a..343ec688f 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -680,14 +680,14 @@ int main(int argc, char ** argv) { case 'c': check=1; break; case 'i': - req_nr_inodes = (unsigned long) atol(optarg); + req_nr_inodes = strtoul_or_err(optarg, + _("failed to parse number of inodes")); break; case 'l': listfile = optarg; break; case 'n': - i = strtoul(optarg,&tmp,0); - if (*tmp) - usage(); + i = strtoul_or_err(optarg, + _("failed to parse maximum length of filenames")); if (i == 14) magic = MINIX_SUPER_MAGIC; else if (i == 30) @@ -719,13 +719,8 @@ int main(int argc, char ** argv) { argc--; argv++; } - if (argc > 0) { - BLOCKS = strtol(argv[0],&tmp,0); - if (*tmp) { - printf(_("strtol error: number of blocks not specified")); - usage(); - } - } + if (argc > 0) + BLOCKS = strtoul_or_err(argv[0], _("failed to parse number of blocks")); if (!device_name) { usage(); |