diff options
author | Ruediger Meier | 2017-06-19 20:52:50 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-26 14:38:24 +0200 |
commit | 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch) | |
tree | 5e74a0cd99493e934780db2b434c75e995a6bd17 /disk-utils/mkfs.c | |
parent | misc: never use usage(ERROR) (diff) | |
download | kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.gz kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.xz kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.zip |
misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
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) |