pstree: new applet. +1664 bytes

   text    data     bss     dec     hex filename
 883379     936   17192  901507   dc183 busybox_old
 885043     936   17192  903171   dc803 busybox_unstripped

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/libbb/procps.c b/libbb/procps.c
index 7924660..f22a55d 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -302,6 +302,7 @@
 				goto got_entry;
 			closedir(sp->task_dir);
 			sp->task_dir = NULL;
+			sp->main_thread_pid = 0;
 		}
 #endif
 		entry = readdir(sp->dir);
@@ -321,6 +322,7 @@
 			char task_dir[sizeof("/proc/%u/task") + sizeof(int)*3];
 			sprintf(task_dir, "/proc/%u/task", pid);
 			sp->task_dir = xopendir(task_dir);
+			sp->main_thread_pid = pid;
 			continue;
 		}
 #endif