]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: use err() rather than perror() && exit()
authorSami Kerola <kerolasa@iki.fi>
Sun, 2 Nov 2014 20:26:27 +0000 (20:26 +0000)
committerKarel Zak <kzak@redhat.com>
Fri, 7 Nov 2014 12:21:05 +0000 (13:21 +0100)
The messsages in err() are verified from po/util-linux.pot to be already
part of translations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/mkswap.c

index b2713ab99cbc0aad2f265dfb64405b29def0ff87..14adf0fed5c1732e0e9aff8ce137ab3401ac55d8 100644 (file)
@@ -209,10 +209,8 @@ get_size(const char *file)
        unsigned long long size;
 
        fd = open(file, O_RDONLY);
-       if (fd < 0) {
-               perror(file);
-               exit(EXIT_FAILURE);
-       }
+       if (fd < 0)
+               err(EXIT_FAILURE, _("cannot open %s"), file);
        if (blkdev_get_size(fd, &size) == 0)
                size /= pagesize;
 
@@ -434,19 +432,14 @@ main(int argc, char **argv) {
                        "%s is mounted; will not make swapspace"),
                        device_name);
 
-       if (stat(device_name, &statbuf) < 0) {
-               perror(device_name);
-               exit(EXIT_FAILURE);
-       }
+       if (stat(device_name, &statbuf) < 0)
+               err(EXIT_FAILURE, _("stat failed %s"), device_name);
        if (S_ISBLK(statbuf.st_mode))
                DEV = open(device_name, O_RDWR | O_EXCL);
        else
                DEV = open(device_name, O_RDWR);
-
-       if (DEV < 0) {
-               perror(device_name);
-               exit(EXIT_FAILURE);
-       }
+       if (DEV < 0)
+               err(EXIT_FAILURE, _("cannot open %s"), device_name);
 
        if (!S_ISBLK(statbuf.st_mode))
                check=0;