[PATCH 4/8] mkswap: use err() rather than perror() && exit()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The messsages in err() are verified from po/util-linux.pot to be already
part of translations.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 disk-utils/mkswap.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index b2713ab..14adf0f 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;
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux