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/fsfreeze.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sys-utils/fsfreeze.c') diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c index b1fa4fa8c..8b0d5d10e 100644 --- a/sys-utils/fsfreeze.c +++ b/sys-utils/fsfreeze.c @@ -33,9 +33,10 @@ enum fs_operation { UNFREEZE }; -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { - fprintf(out, USAGE_HEADER); + FILE *out = stdout; + fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] \n"), program_invocation_short_name); @@ -45,12 +46,12 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(USAGE_OPTIONS, out); fputs(_(" -f, --freeze freeze the filesystem\n"), out); fputs(_(" -u, --unfreeze unfreeze the filesystem\n"), out); - fprintf(out, USAGE_SEPARATOR); - fprintf(out, USAGE_HELP); - fprintf(out, USAGE_VERSION); + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); + fputs(USAGE_VERSION, out); fprintf(out, USAGE_MAN_TAIL("fsfreeze(8)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } int main(int argc, char **argv) @@ -85,7 +86,7 @@ int main(int argc, char **argv) switch(c) { case 'h': - usage(stdout); + usage(); break; case 'f': action = FREEZE; @@ -109,7 +110,7 @@ int main(int argc, char **argv) if (optind != argc) { warnx(_("unexpected number of arguments")); - usage(stderr); + errtryhelp(EXIT_FAILURE); } fd = open(path, O_RDONLY); -- cgit v1.2.3-55-g7522