diff options
Diffstat (limited to 'disk-utils/mkfs.c')
-rw-r--r-- | disk-utils/mkfs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c index cf1a312d9..25cc59d20 100644 --- a/disk-utils/mkfs.c +++ b/disk-utils/mkfs.c @@ -38,8 +38,9 @@ #define DEFAULT_FSTYPE "ext2" #endif -static void __attribute__ ((__noreturn__)) usage(FILE * out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] [-t <type>] [fs-options] <device> [<size>]\n"), program_invocation_short_name); @@ -60,7 +61,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fprintf(out, USAGE_MAN_TAIL("mkfs(8)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } static void __attribute__ ((__noreturn__)) print_version(void) @@ -106,7 +107,7 @@ int main(int argc, char **argv) fstype = optarg; break; case 'h': - usage(stdout); + usage(); case VERSION_OPTION: print_version(); default: @@ -114,8 +115,10 @@ int main(int argc, char **argv) more = 1; break; /* start of specific arguments */ } - if (optind == argc) - usage(stderr); + if (optind == argc) { + warnx(_("no device specified")); + errtryhelp(EXIT_FAILURE); + } /* If -t wasn't specified, use the default */ if (fstype == NULL) |