diff options
author | Ruediger Meier | 2017-06-19 20:51:50 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-26 14:38:24 +0200 |
commit | 5118d1be2ade514079f5506bafdf028389ff362e (patch) | |
tree | 4c84d14033e431dff9ade15678136ae8b6f4b4ef /misc-utils/namei.c | |
parent | misc: cleanup and fix --unknownopt issues (diff) | |
download | kernel-qcow2-util-linux-5118d1be2ade514079f5506bafdf028389ff362e.tar.gz kernel-qcow2-util-linux-5118d1be2ade514079f5506bafdf028389ff362e.tar.xz kernel-qcow2-util-linux-5118d1be2ade514079f5506bafdf028389ff362e.zip |
misc: never use usage(ERROR)
We are using better/shorter error messages and somtimes
also errtryhelp().
Here we fix all cases where the usage function took
an int argument for exit_code.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'misc-utils/namei.c')
-rw-r--r-- | misc-utils/namei.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/misc-utils/namei.c b/misc-utils/namei.c index 0b0a0579c..dcaf5d2eb 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -320,10 +320,10 @@ print_namei(struct namei *nm, char *path) return 0; } -static void usage(int rc) +static void __attribute__((__noreturn__)) usage(void) { const char *p = program_invocation_short_name; - FILE *out = rc == EXIT_FAILURE ? stderr : stdout; + FILE *out = stdout; if (!*p) p = "namei"; @@ -346,7 +346,7 @@ static void usage(int rc) " -v, --vertical vertical align of modes and owners\n"), out); fprintf(out, USAGE_MAN_TAIL("namei(1)")); - exit(rc); + exit(EXIT_SUCCESS); } static const struct option longopts[] = @@ -376,7 +376,7 @@ main(int argc, char **argv) while ((c = getopt_long(argc, argv, "hVlmnovx", longopts, NULL)) != -1) { switch(c) { case 'h': - usage(EXIT_SUCCESS); + usage(); break; case 'V': printf(UTIL_LINUX_VERSION); @@ -406,7 +406,7 @@ main(int argc, char **argv) if (optind == argc) { warnx(_("pathname argument is missing")); - usage(EXIT_FAILURE); + errtryhelp(EXIT_FAILURE); } ucache = new_idcache(); |