[BusyBox-cvs] svn commit: trunk/busybox/e2fsprogs

vapier at busybox.net vapier at busybox.net
Sat Jun 11 22:24:16 UTC 2005


Author: vapier
Date: 2005-06-11 16:24:15 -0600 (Sat, 11 Jun 2005)
New Revision: 10530

Log:
use xmalloc() and bb_perror_msg_and_die()

Modified:
   trunk/busybox/e2fsprogs/mke2fs.c


Changeset:
Modified: trunk/busybox/e2fsprogs/mke2fs.c
===================================================================
--- trunk/busybox/e2fsprogs/mke2fs.c	2005-06-11 22:10:42 UTC (rev 10529)
+++ trunk/busybox/e2fsprogs/mke2fs.c	2005-06-11 22:24:15 UTC (rev 10530)
@@ -547,12 +547,7 @@
 	int retval;
 	unsigned int *magic;
 
-	buf = malloc(512*nsect);
-	if (!buf) {
-		printf(_("Out of memory erasing sectors %d-%d\n"),
-		       sect, sect + nsect - 1);
-		exit(1);
-	}
+	buf = xmalloc(512*nsect);
 
 	if (sect == 0) {
 		/* Check for a BSD disklabel, and don't erase it if so */
@@ -838,7 +833,7 @@
 	if (oldpath) {
 		char *newpath;
 		
-		newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
+		newpath = xmalloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
 		strcpy (newpath, PATH_SET);
 		strcat (newpath, ":");
 		strcat (newpath, oldpath);
@@ -872,8 +867,7 @@
 
 #ifdef __linux__
 	if (uname(&ut)) {
-		perror("uname");
-		exit(1);
+		bb_perror_msg_and_die("uname");
 	}
 	linux_version_code = parse_version_number(ut.release);
 	if (linux_version_code && linux_version_code < (2*65536 + 2*256)) {




More information about the busybox-cvs mailing list