summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorRuediger Meier2017-06-19 20:52:50 +0200
committerRuediger Meier2017-06-26 14:38:24 +0200
commit6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch)
tree5e74a0cd99493e934780db2b434c75e995a6bd17 /disk-utils
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 'disk-utils')
-rw-r--r--disk-utils/addpart.c13
-rw-r--r--disk-utils/delpart.c13
-rw-r--r--disk-utils/fdformat.c13
-rw-r--r--disk-utils/fdisk.c31
-rw-r--r--disk-utils/fsck.minix.c14
-rw-r--r--disk-utils/isosize.c13
-rw-r--r--disk-utils/mkfs.bfs.c26
-rw-r--r--disk-utils/mkfs.c13
-rw-r--r--disk-utils/mkfs.minix.c10
-rw-r--r--disk-utils/mkswap.c11
-rw-r--r--disk-utils/partx.c14
-rw-r--r--disk-utils/resizepart.c13
-rw-r--r--disk-utils/swaplabel.c14
13 files changed, 117 insertions, 81 deletions
diff --git a/disk-utils/addpart.c b/disk-utils/addpart.c
index f99e9bc9c..07f4ca9a1 100644
--- a/disk-utils/addpart.c
+++ b/disk-utils/addpart.c
@@ -8,8 +8,9 @@
#include "partx.h"
#include "strutils.h"
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s <disk device> <partition number> <start> <length>\n"),
program_invocation_short_name);
@@ -21,7 +22,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("addpart(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -44,13 +45,15 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
- if (argc != 5)
- usage(stderr);
+ if (argc != 5) {
+ warnx(_("not enough arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
if ((fd = open(argv[1], O_RDONLY)) < 0)
err(EXIT_FAILURE, _("cannot open %s"), argv[1]);
diff --git a/disk-utils/delpart.c b/disk-utils/delpart.c
index 1f82b58e9..7f347c886 100644
--- a/disk-utils/delpart.c
+++ b/disk-utils/delpart.c
@@ -8,8 +8,9 @@
#include "partx.h"
#include "strutils.h"
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s <disk device> <partition number>\n"),
program_invocation_short_name);
@@ -21,7 +22,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("delpart(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -44,13 +45,15 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
- if (argc != 3)
- usage(stderr);
+ if (argc != 3) {
+ warnx(_("not enough arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
if ((fd = open(argv[1], O_RDONLY)) < 0)
diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c
index 60d61dcf8..4b5ed5690 100644
--- a/disk-utils/fdformat.c
+++ b/disk-utils/fdformat.c
@@ -138,8 +138,9 @@ static void verify_disk(int ctrl, unsigned int track_from, unsigned int track_to
printf(_("done\n"));
}
-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);
@@ -159,7 +160,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("fdformat(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -207,7 +208,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
@@ -215,8 +216,10 @@ int main(int argc, char **argv)
argc -= optind;
argv += optind;
- if (argc < 1)
- usage(stderr);
+ if (argc < 1) {
+ warnx(_("no device specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
if (stat(argv[0], &st) < 0)
err(EXIT_FAILURE, _("stat of %s failed"), argv[0]);
if (!S_ISBLK(st.st_mode))
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c
index 832ae4959..afd968076 100644
--- a/disk-utils/fdisk.c
+++ b/disk-utils/fdisk.c
@@ -749,8 +749,10 @@ void follow_wipe_mode(struct fdisk_context *cxt)
fdisk_get_collision(cxt));
}
-static void __attribute__ ((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
+
fputs(USAGE_HEADER, out);
fprintf(out,
@@ -789,7 +791,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
list_available_columns(out);
fprintf(out, USAGE_MAN_TAIL("fdisk(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
@@ -852,7 +854,7 @@ int main(int argc, char **argv)
size_t sz = strtou32_or_err(optarg,
_("invalid sector size argument"));
if (sz != 512 && sz != 1024 && sz != 2048 && sz != 4096)
- usage(stderr);
+ errx(EXIT_FAILURE, _("invalid sector size argument"));
fdisk_save_user_sector_size(cxt, sz, sz);
break;
}
@@ -879,10 +881,8 @@ int main(int argc, char **argv)
fdisk_dos_enable_compatible(lb, TRUE);
else if (strcmp(p, "nondos") == 0)
fdisk_dos_enable_compatible(lb, FALSE);
- else {
- warnx(_("unknown compatibility mode '%s'"), p);
- usage(stderr);
- }
+ else
+ errx(EXIT_FAILURE, _("unknown compatibility mode '%s'"), p);
}
/* use default if no optarg specified */
break;
@@ -929,7 +929,7 @@ int main(int argc, char **argv)
if (optarg && *optarg == '=')
optarg++;
if (fdisk_set_unit(cxt, optarg) != 0)
- usage(stderr);
+ errx(EXIT_FAILURE, _("unsupported unit"));
break;
case 'V': /* preferred for util-linux */
case 'v': /* for backward compatibility only */
@@ -946,7 +946,7 @@ int main(int argc, char **argv)
errx(EXIT_FAILURE, _("unsupported wipe mode"));
break;
case 'h':
- usage(stdout);
+ usage();
case OPT_BYTES:
fdisk_set_size_unit(cxt, FDISK_SIZEUNIT_BYTES);
break;
@@ -985,9 +985,10 @@ int main(int argc, char **argv)
case ACT_SHOWSIZE:
/* deprecated */
- if (argc - optind <= 0)
- usage(stderr);
-
+ if (argc - optind <= 0) {
+ warnx(_("bad usage"));
+ errtryhelp(EXIT_FAILURE);
+ }
for (i = optind; i < argc; i++) {
uintmax_t blks = get_dev_blocks(argv[i]);
@@ -999,8 +1000,10 @@ int main(int argc, char **argv)
break;
case ACT_FDISK:
- if (argc-optind != 1)
- usage(stderr);
+ if (argc-optind != 1) {
+ warnx(_("bad usage"));
+ errtryhelp(EXIT_FAILURE);
+ }
/* Here starts interactive mode, use fdisk_{warn,info,..} functions */
color_scheme_enable("welcome", UL_COLOR_GREEN);
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index bff810ec3..13b12926c 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -177,7 +177,8 @@ leave(int status) {
}
static void __attribute__((__noreturn__))
-usage(FILE *out) {
+usage(void) {
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] <device>\n"), program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
@@ -194,7 +195,7 @@ usage(FILE *out) {
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("fsck.minix(8)"));
- leave(out == stderr ? FSCK_EX_USAGE : FSCK_EX_OK);
+ exit(FSCK_EX_OK);
}
static void die(const char *fmt, ...)
@@ -1329,7 +1330,7 @@ main(int argc, char **argv) {
printf(UTIL_LINUX_VERSION);
return FSCK_EX_OK;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(FSCK_EX_USAGE);
}
@@ -1337,9 +1338,10 @@ main(int argc, char **argv) {
argv += optind;
if (0 < argc) {
device_name = argv[0];
- } else
- usage(stderr);
-
+ } else {
+ warnx(_("no device specified"));
+ errtryhelp(FSCK_EX_USAGE);
+ }
check_mount(); /* trying to check a mounted filesystem? */
if (repair && !automatic && (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)))
die(_("need terminal for interactive repairs"));
diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c
index b5ac56262..ed43c9d70 100644
--- a/disk-utils/isosize.c
+++ b/disk-utils/isosize.c
@@ -126,8 +126,9 @@ static void isosize(int argc, char *filenamep, int xflag, long divisor)
close(fd);
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <iso9660_image_file>\n"),
@@ -144,7 +145,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("isosize(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -179,15 +180,17 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
ct = argc - optind;
- if (ct <= 0)
- usage(stderr);
+ if (ct <= 0) {
+ warnx(_("no device specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
for (j = optind; j < argc; j++)
isosize(ct, argv[j], xflag, divisor);
diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c
index 0bf18509e..b19afa7cd 100644
--- a/disk-utils/mkfs.bfs.c
+++ b/disk-utils/mkfs.bfs.c
@@ -67,8 +67,9 @@ struct bfsde {
char d_name[BFS_NAMELEN];
};
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fprintf(out,
_("Usage: %s [options] device [block-count]\n"),
program_invocation_short_name);
@@ -88,7 +89,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -h, --help display this help and exit\n\n"));
fprintf(out, USAGE_MAN_TAIL("mkfs.bfs(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void __attribute__ ((__noreturn__)) print_version(void)
@@ -129,9 +130,10 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- if (argc < 2)
- usage(stderr);
-
+ if (argc < 2) {
+ warnx(_("not enough arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
if (argc == 2 && !strcmp(argv[1], "-V"))
print_version();
@@ -170,14 +172,16 @@ int main(int argc, char **argv)
case VERSION_OPTION:
print_version();
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
}
- if (optind == argc)
- usage(stderr);
+ if (optind == argc) {
+ warnx(_("no device specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
device = argv[optind++];
@@ -191,8 +195,10 @@ int main(int argc, char **argv)
if (optind == argc - 1)
user_specified_total_blocks =
strtou64_or_err(argv[optind], _("invalid block-count"));
- else if (optind != argc)
- usage(stderr);
+ else if (optind != argc) {
+ warnx(_("bad usage"));
+ errtryhelp(EXIT_FAILURE);
+ }
if (blkdev_get_sectors(fd, &total_blocks) == -1) {
if (!user_specified_total_blocks)
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index cf1a312d9..25cc59d20 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -38,8 +38,9 @@
#define DEFAULT_FSTYPE "ext2"
#endif
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] [-t <type>] [fs-options] <device> [<size>]\n"),
program_invocation_short_name);
@@ -60,7 +61,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, USAGE_MAN_TAIL("mkfs(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void __attribute__ ((__noreturn__)) print_version(void)
@@ -106,7 +107,7 @@ int main(int argc, char **argv)
fstype = optarg;
break;
case 'h':
- usage(stdout);
+ usage();
case VERSION_OPTION:
print_version();
default:
@@ -114,8 +115,10 @@ int main(int argc, char **argv)
more = 1;
break; /* start of specific arguments */
}
- if (optind == argc)
- usage(stderr);
+ if (optind == argc) {
+ warnx(_("no device specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
/* If -t wasn't specified, use the default */
if (fstype == NULL)
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 98a62668a..39e159f7a 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -131,8 +131,9 @@ static char *zone_map;
#define mark_zone(x) (setbit(zone_map,(x)-get_first_zone()+1))
#define unmark_zone(x) (clrbit(zone_map,(x)-get_first_zone()+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] /dev/name [blocks]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
@@ -147,7 +148,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("mkfs.minix(8)"));
- exit(out == stderr ? MKFS_EX_USAGE : MKFS_EX_OK);
+ exit(MKFS_EX_OK);
}
#ifdef TEST_SCRIPT
@@ -795,7 +796,7 @@ int main(int argc, char ** argv)
printf(UTIL_LINUX_VERSION);
return MKFS_EX_OK;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(MKFS_EX_USAGE);
}
@@ -810,7 +811,8 @@ int main(int argc, char ** argv)
ctl.fs_blocks = strtoul_or_err(argv[0], _("failed to parse number of blocks"));
if (!ctl.device_name) {
- usage(stderr);
+ warnx(_("no device specified"));
+ errtryhelp(MKFS_EX_USAGE);
}
check_user_instructions(&ctl);
if (is_mounted(ctl.device_name))
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index ff076c8ab..73e5258ed 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -141,8 +141,9 @@ static void set_uuid_and_label(const struct mkswap_control *ctl)
}
}
-static void __attribute__ ((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fprintf(out,
_("\nUsage:\n"
" %s [options] device [size]\n"),
@@ -162,7 +163,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void page_bad(struct mkswap_control *ctl, unsigned int page)
@@ -400,7 +401,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
@@ -412,7 +413,7 @@ int main(int argc, char **argv)
block_count = argv[optind++];
if (optind != argc) {
warnx(_("only one device argument is currently supported"));
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
#ifdef HAVE_LIBUUID
@@ -428,7 +429,7 @@ int main(int argc, char **argv)
if (!ctl.devname) {
warnx(_("error: Nowhere to set up swap on?"));
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (block_count) {
/* this silly user specified the number of blocks explicitly */
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 93fbc9c1d..9a868cd81 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -743,8 +743,9 @@ static blkid_partlist get_partlist(blkid_probe pr,
return ls;
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -781,7 +782,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fprintf(out, USAGE_MAN_TAIL("partx(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -891,7 +892,7 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
}
case 'h':
- usage(stdout);
+ usage();
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
@@ -963,9 +964,10 @@ int main(int argc, char **argv)
device = NULL;
part_devno = 0;
}
- } else
- usage(stderr);
-
+ } else {
+ warnx(_("bad usage"));
+ errtryhelp(EXIT_FAILURE);
+ }
if (device && (upper || lower))
errx(EXIT_FAILURE, _("--nr and <partition> are mutually exclusive"));
diff --git a/disk-utils/resizepart.c b/disk-utils/resizepart.c
index 97533e26f..a234c8079 100644
--- a/disk-utils/resizepart.c
+++ b/disk-utils/resizepart.c
@@ -13,8 +13,9 @@
#include "strutils.h"
#include "closestream.h"
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s <disk device> <partition number> <length>\n"),
program_invocation_short_name);
@@ -26,7 +27,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("resizepart(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static int get_partition_start(int fd, int partno, uint64_t *start)
@@ -86,13 +87,15 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
- if (argc != 4)
- usage(stderr);
+ if (argc != 4) {
+ warnx(_("not enough arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
wholedisk = argv[1];
partno = strtou32_or_err(argv[2], _("invalid partition number argument"));
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) {