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 --- sys-utils/mountpoint.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sys-utils/mountpoint.c') diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c index ab0951f9b..d07077252 100644 --- a/sys-utils/mountpoint.c +++ b/sys-utils/mountpoint.c @@ -111,8 +111,9 @@ static int print_devno(const struct mountpoint_control *ctl) return 0; } -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fputs(USAGE_HEADER, out); fprintf(out, _(" %1$s [-qd] /path/to/directory\n" @@ -130,7 +131,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(USAGE_VERSION, out); fprintf(out, USAGE_MAN_TAIL("mountpoint(1)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } int main(int argc, char **argv) @@ -167,7 +168,7 @@ int main(int argc, char **argv) ctl.dev_devno = 1; break; case 'h': - usage(stdout); + usage(); break; case 'V': printf(UTIL_LINUX_VERSION); @@ -177,8 +178,10 @@ int main(int argc, char **argv) } } - if (optind + 1 != argc) - usage(stderr); + if (optind + 1 != argc) { + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); + } ctl.path = argv[optind]; -- cgit v1.2.3-55-g7522