svn commit: trunk/busybox: libbb procps

vda at busybox.net vda at busybox.net
Wed Mar 28 21:57:12 UTC 2007


Author: vda
Date: 2007-03-28 14:57:12 -0700 (Wed, 28 Mar 2007)
New Revision: 18266

Log:
ps: work around libc bug: printf("%.*s\n", MAX_INT, buffer)


Modified:
   trunk/busybox/libbb/xfuncs.c
   trunk/busybox/procps/ps.c


Changeset:
Modified: trunk/busybox/libbb/xfuncs.c
===================================================================
--- trunk/busybox/libbb/xfuncs.c	2007-03-28 20:35:13 UTC (rev 18265)
+++ trunk/busybox/libbb/xfuncs.c	2007-03-28 21:57:12 UTC (rev 18266)
@@ -253,9 +253,9 @@
 	buf[4] = '\0';
 }
 
-// Convert unsigned integer to ascii, writing into supplied buffer.  A
-// truncated result is always null terminated (unless buflen is 0), and
-// contains the first few digits of the result ala strncpy.
+// Convert unsigned integer to ascii, writing into supplied buffer.
+// A truncated result contains the first few digits of the result ala strncpy.
+// Returns a pointer past last generated digit, does _not_ store NUL.
 void BUG_sizeof_unsigned_not_4(void);
 char *utoa_to_buf(unsigned n, char *buf, unsigned buflen)
 {

Modified: trunk/busybox/procps/ps.c
===================================================================
--- trunk/busybox/procps/ps.c	2007-03-28 20:35:13 UTC (rev 18265)
+++ trunk/busybox/procps/ps.c	2007-03-28 21:57:12 UTC (rev 18266)
@@ -262,7 +262,9 @@
 		parse_o(default_o);
 	post_process();
 
-	terminal_width = INT_MAX;
+	/* Was INT_MAX, but some libc's go belly up with printf("%.*s")
+	 * and such large widths */
+	terminal_width = 30000;
 	if (isatty(1)) {
 		get_terminal_width_height(1, &terminal_width, NULL);
 		terminal_width--;




More information about the busybox-cvs mailing list