Truncated thread names in pstree

Dag Wieers dag at wieers.com
Sat Jun 1 00:34:16 UTC 2013


Hi,

I noticed that thread names are truncated by one character (to 14 
characters instead of 15), the below patch fixes the issue. (The 
attached patch has proper whitespaces !)

--- busybox-1.21.0/procps/pstree.c.orig 2013-06-01 02:27:14.008530872 +0200
+++ busybox-1.21.0/procps/pstree.c      2013-06-01 02:31:36.483537110 +0200
@@ -342,7 +342,7 @@
  static void handle_thread(const char *comm, pid_t pid, pid_t ppid, uid_t uid)
  {
         char threadname[COMM_LEN + 2];
-       sprintf(threadname, "{%.*s}", COMM_LEN - 2, comm);
+       sprintf(threadname, "{%.*s}", COMM_LEN - 1, comm);
         add_proc(threadname, pid, ppid, uid/*, 1*/);
  }
  #endif

-- 
-- dag wieers, dag at wieers.com, http://dag.wieers.com/
-- dagit linux solutions, contact at dagit.net, http://dagit.net/

[Any errors in spelling, tact or fact are transmission errors]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.21.0-pstree-threadname.patch
Type: text/x-patch
Size: 457 bytes
Desc: 
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130601/d6477d89/attachment.bin>


More information about the busybox mailing list