svn commit: trunk/busybox/util-linux

landley at busybox.net landley at busybox.net
Wed Sep 14 15:28:17 UTC 2005


Author: landley
Date: 2005-09-14 08:28:15 -0700 (Wed, 14 Sep 2005)
New Revision: 11458

Log:
Cleanup patch from Tito.


Modified:
   trunk/busybox/util-linux/readprofile.c


Changeset:
Modified: trunk/busybox/util-linux/readprofile.c
===================================================================
--- trunk/busybox/util-linux/readprofile.c	2005-09-14 15:09:06 UTC (rev 11457)
+++ trunk/busybox/util-linux/readprofile.c	2005-09-14 15:28:15 UTC (rev 11458)
@@ -138,8 +138,6 @@
 		}
 
 		fd = bb_xopen(defaultpro,O_WRONLY);
-		if (fd < 0)
-			bb_perror_msg_and_die(defaultpro);
 
 		if (write(fd, &multiplier, to_write) != to_write)
 			bb_perror_msg_and_die("error writing %s", defaultpro);
@@ -151,13 +149,14 @@
 	/*
 	 * Use an fd for the profiling buffer, to skip stdio overhead
 	 */
-	if (((proFd = bb_xopen(proFile,O_RDONLY)) < 0)
-	    || ((int)(len=lseek(proFd,0,SEEK_END)) < 0)
+	 
+	proFd = bb_xopen(proFile,O_RDONLY);
+	
+	if (((int)(len=lseek(proFd,0,SEEK_END)) < 0)
 	    || (lseek(proFd,0,SEEK_SET) < 0))
 		bb_perror_msg_and_die(proFile);
 
-	if (!(buf = xmalloc(len)))
-		bb_perror_nomsg_and_die();
+	buf = xmalloc(len);
 
 	if (read(proFd,buf,len) != len)
 		bb_perror_msg_and_die(proFile);
@@ -176,8 +175,8 @@
 				small++;
 		}
 		if (big > small) {
-			fprintf(stderr,"Assuming reversed byte order. "
-				"Use -n to force native byte order.\n");
+			bb_error_msg("Assuming reversed byte order. "
+				"Use -n to force native byte order.");
 			for (p = buf; p < buf+entries; p++)
 				for (i = 0; i < sizeof(*buf)/2; i++) {
 					unsigned char *b = (unsigned char *) p;
@@ -199,8 +198,6 @@
 	total = 0;
 
 	map = bb_xfopen(mapFile, "r");
-	if (map == NULL)
-		bb_perror_msg_and_die(mapFile);
 
 	while (fgets(mapline,S_LEN,map)) {
 		if (sscanf(mapline,"%llx %s %s",&fn_add,mode,fn_name) != 3)
@@ -215,7 +212,7 @@
 	}
 
 	if (!add0)
-		bb_error_msg_and_die("can't find \"_stext\" in %s\n", mapFile);
+		bb_error_msg_and_die("can't find \"_stext\" in %s", mapFile);
 
 	/*
 	 * Main loop.
@@ -224,7 +221,7 @@
 		unsigned int this = 0;
 
 		if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name) != 3)
-			bb_error_msg_and_die("%s(%i): wrong map line\n",
+			bb_error_msg_and_die("%s(%i): wrong map line",
 					     mapFile, maplineno);
 
 		header_printed = 0;




More information about the busybox-cvs mailing list