aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-28 21:57:12 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-28 21:57:12 +0000
commit450196c119e22268c9176cb7887cceb22bf8e9ff (patch)
treee4a76e61f40840b4dcf2015d55f9ecfa93a8ee23
parentb7cffd4bedf14770a7096a11a6e46cc497ff37c6 (diff)
downloadbusybox-w32-450196c119e22268c9176cb7887cceb22bf8e9ff.tar.gz
busybox-w32-450196c119e22268c9176cb7887cceb22bf8e9ff.tar.bz2
busybox-w32-450196c119e22268c9176cb7887cceb22bf8e9ff.zip
ps: work around libc bug: printf("%.*s\n", MAX_INT, buffer)
-rw-r--r--libbb/xfuncs.c6
-rw-r--r--procps/ps.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index e1632a4b6..68ad3dec4 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -253,9 +253,9 @@ void smart_ulltoa5(unsigned long long ul, char buf[5])
253 buf[4] = '\0'; 253 buf[4] = '\0';
254} 254}
255 255
256// Convert unsigned integer to ascii, writing into supplied buffer. A 256// Convert unsigned integer to ascii, writing into supplied buffer.
257// truncated result is always null terminated (unless buflen is 0), and 257// A truncated result contains the first few digits of the result ala strncpy.
258// contains the first few digits of the result ala strncpy. 258// Returns a pointer past last generated digit, does _not_ store NUL.
259void BUG_sizeof_unsigned_not_4(void); 259void BUG_sizeof_unsigned_not_4(void);
260char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) 260char *utoa_to_buf(unsigned n, char *buf, unsigned buflen)
261{ 261{
diff --git a/procps/ps.c b/procps/ps.c
index c1cb64397..2be0b3605 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -262,7 +262,9 @@ int ps_main(int argc, char **argv)
262 parse_o(default_o); 262 parse_o(default_o);
263 post_process(); 263 post_process();
264 264
265 terminal_width = INT_MAX; 265 /* Was INT_MAX, but some libc's go belly up with printf("%.*s")
266 * and such large widths */
267 terminal_width = 30000;
266 if (isatty(1)) { 268 if (isatty(1)) {
267 get_terminal_width_height(1, &terminal_width, NULL); 269 get_terminal_width_height(1, &terminal_width, NULL);
268 terminal_width--; 270 terminal_width--;