summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkswap.c
diff options
context:
space:
mode:
authorSami Kerola2014-11-02 21:26:27 +0100
committerKarel Zak2014-11-07 13:21:05 +0100
commit3d5c8ba1c9f0e2eada689204bc8e2d429611b0c9 (patch)
treedb2090a46e632d45e5bf146cc0aa024c65db54f6 /disk-utils/mkswap.c
parentmkswap: remove unnecessary size check (diff)
downloadkernel-qcow2-util-linux-3d5c8ba1c9f0e2eada689204bc8e2d429611b0c9.tar.gz
kernel-qcow2-util-linux-3d5c8ba1c9f0e2eada689204bc8e2d429611b0c9.tar.xz
kernel-qcow2-util-linux-3d5c8ba1c9f0e2eada689204bc8e2d429611b0c9.zip
mkswap: use err() rather than perror() && exit()
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>
Diffstat (limited to 'disk-utils/mkswap.c')
-rw-r--r--disk-utils/mkswap.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index b2713ab99..14adf0fed 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -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;