[git commit] top/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor"

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 2 09:31:37 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=32711c414193b81f215aee060ae8138675572280
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/procps.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libbb/procps.c b/libbb/procps.c
index 295048c..b4557e7 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -583,6 +583,8 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
 		buf[sz] = '\0';
 		while (--sz >= 0 && buf[sz] == '\0')
 			continue;
+		/* Prevent basename("process foo/bar") = "bar" */
+		strchrnul(buf, ' ')[0] = '\0';
 		base = bb_basename(buf); /* before we replace argv0's NUL with space */
 		while (sz >= 0) {
 			if ((unsigned char)(buf[sz]) < ' ')


More information about the busybox-cvs mailing list