From: Werner Fink Date: Wed, 7 Sep 2011 09:04:35 +0000 (+0200) Subject: Add another 2 for thread brackets in pstree.c X-Git-Tag: v22.15~3^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e28a3dd2c65443471d0528c69cb9bc1af30865ce;p=psmisc Add another 2 for thread brackets in pstree.c Signed-off-by: Werner Fink --- diff --git a/ChangeLog b/ChangeLog index 4217a09..e5c36fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,10 +3,12 @@ Changes in 22.15 * Really apply patch for SF#31110178 RH#651794 * Conditionally use fork before stat calls * Patch from Corrina Vinschen for compiling on cygwin + * Remove doubled content in src/lists.h + * Add another 2 for thread brackets in pstree.c Changes in 22.14 ================ - * Fix file descriptor as weel as memory leaks in fuser + * Fix file descriptor as well as memory leaks in fuser * Strip @ symbol from file names read from /proc/net/unix * Above 2 changes close openSuSE bugs #536209, #529520, and #417841 and provided by Werner Fink diff --git a/src/pstree.c b/src/pstree.c index 39f345b..452f823 100644 --- a/src/pstree.c +++ b/src/pstree.c @@ -680,10 +680,10 @@ static void read_proc(void) if ((taskdir = opendir(taskpath)) != 0) { /* if we have this dir, we're on 2.6 */ - if (! (threadname = malloc(COMM_LEN+1))) { + if (! (threadname = malloc(COMM_LEN + 2 + 1))) { exit(2); } - sprintf(threadname, "{%.*s}", COMM_LEN-2, comm); + sprintf(threadname, "{%.*s}", COMM_LEN, comm); while ((dt = readdir(taskdir)) != NULL) { if ((thread = atoi(dt->d_name)) != 0) { if (thread != pid) {