From 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Mon, 19 Jun 2017 20:52:50 +0200 Subject: misc: never use usage(stderr) Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier --- disk-utils/mkswap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'disk-utils/mkswap.c') diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index ff076c8ab..73e5258ed 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -141,8 +141,9 @@ static void set_uuid_and_label(const struct mkswap_control *ctl) } } -static void __attribute__ ((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fprintf(out, _("\nUsage:\n" " %s [options] device [size]\n"), @@ -162,7 +163,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out) " -V, --version output version information and exit\n" " -h, --help display this help and exit\n\n")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } static void page_bad(struct mkswap_control *ctl, unsigned int page) @@ -400,7 +401,7 @@ int main(int argc, char **argv) printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); case 'h': - usage(stdout); + usage(); default: errtryhelp(EXIT_FAILURE); } @@ -412,7 +413,7 @@ int main(int argc, char **argv) block_count = argv[optind++]; if (optind != argc) { warnx(_("only one device argument is currently supported")); - usage(stderr); + errtryhelp(EXIT_FAILURE); } #ifdef HAVE_LIBUUID @@ -428,7 +429,7 @@ int main(int argc, char **argv) if (!ctl.devname) { warnx(_("error: Nowhere to set up swap on?")); - usage(stderr); + errtryhelp(EXIT_FAILURE); } if (block_count) { /* this silly user specified the number of blocks explicitly */ -- cgit v1.2.3-55-g7522