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 /sys-utils/swapon.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 'sys-utils/swapon.c')
-rw-r--r-- | sys-utils/swapon.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index a46633b16..5242b96f4 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -782,9 +782,11 @@ static int swapon_all(struct swapon_ctl *ctl) } -static void __attribute__ ((__noreturn__)) usage(FILE * out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; size_t i; + fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] [<spec>]\n"), program_invocation_short_name); @@ -829,7 +831,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fprintf(out, " %-5s %s\n", infos[i].name, _(infos[i].help)); fprintf(out, USAGE_MAN_TAIL("swapon(8)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } int main(int argc, char *argv[]) @@ -895,7 +897,7 @@ int main(int argc, char *argv[]) ctl.all = 1; break; case 'h': /* help */ - usage(stdout); + usage(); break; case 'o': options = optarg; @@ -980,8 +982,10 @@ int main(int argc, char *argv[]) return status; } - if (ctl.props.no_fail && !ctl.all) - usage(stderr); + if (ctl.props.no_fail && !ctl.all) { + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); + } if (ctl.all) status |= swapon_all(&ctl); |