summaryrefslogtreecommitdiffstats
path: root/sys-utils/fsfreeze.c
diff options
context:
space:
mode:
authorRuediger Meier2017-06-19 20:52:50 +0200
committerRuediger Meier2017-06-26 14:38:24 +0200
commit6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch)
tree5e74a0cd99493e934780db2b434c75e995a6bd17 /sys-utils/fsfreeze.c
parentmisc: never use usage(ERROR) (diff)
downloadkernel-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 'sys-utils/fsfreeze.c')
-rw-r--r--sys-utils/fsfreeze.c17
1 files changed, 9 insertions, 8 deletions
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] <mountpoint>\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);