summaryrefslogtreecommitdiffstats
path: root/disk-utils/swaplabel.c
diff options
context:
space:
mode:
Diffstat (limited to 'disk-utils/swaplabel.c')
-rw-r--r--disk-utils/swaplabel.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
index 233f027d1..c8fede25e 100644
--- a/disk-utils/swaplabel.c
+++ b/disk-utils/swaplabel.c
@@ -111,8 +111,9 @@ err:
return -1;
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] <device>\n"),
program_invocation_short_name);
@@ -127,7 +128,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("swaplabel(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char *argv[])
@@ -152,7 +153,7 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hVL:U:", longopts, NULL)) != -1) {
switch (c) {
case 'h':
- usage(stdout);
+ usage();
break;
case 'V':
printf(UTIL_LINUX_VERSION);
@@ -172,9 +173,10 @@ int main(int argc, char *argv[])
}
}
- if (optind == argc)
- usage(stderr);
-
+ if (optind == argc) {
+ warnx(_("no device specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
devname = argv[optind];
pr = get_swap_prober(devname);
if (pr) {