[PATCH 2/8] mkswap: use xalloc

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

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 disk-utils/mkswap.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index 6223921..a89b208 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -55,6 +55,7 @@
 #include "pathnames.h"
 #include "wholedisk.h"
 #include "writeall.h"
+#include "xalloc.h"
 
 #ifdef HAVE_LIBUUID
 # ifdef HAVE_UUID_UUID_H
@@ -165,9 +166,7 @@ init_signature_page(void) {
 				"instead of the system value %d"),
 				pagesize, kernel_pagesize);
 
-	signature_page = (unsigned long *) calloc(1, pagesize);
-	if (!signature_page)
-		err(EXIT_FAILURE, _("calloc() failed"));
+	signature_page = (unsigned long *) xcalloc(1, pagesize);
 }
 
 static void
@@ -294,9 +293,7 @@ check_blocks(void) {
 	int do_seek = 1;
 	char *buffer;
 
-	buffer = malloc(pagesize);
-	if (!buffer)
-		errx(EXIT_FAILURE, _("Out of memory"));
+	buffer = xmalloc(pagesize);
 	current_page = 0;
 	while (current_page < PAGES) {
 		if (do_seek && lseek(DEV,current_page*pagesize,SEEK_SET) !=
@@ -390,7 +387,7 @@ zap_bootbits(int fd, const char *devname, int force, int is_blkdev)
 				blkid_probe_lookup_value(pr, "PTTYPE",
 						(const char **) &type, NULL);
 			if (type) {
-				type = strdup(type);
+				type = xstrdup(type);
 				zap = 0;
 			}
 			blkid_free_probe(pr);
-- 
1.7.4.1

--
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