summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkswap.c
diff options
context:
space:
mode:
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;