From 32711c414193b81f215aee060ae8138675572280 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 2 Oct 2012 11:31:37 +0200 Subject: top/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor" Signed-off-by: Denys Vlasenko --- libbb/procps.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libbb/procps.c') diff --git a/libbb/procps.c b/libbb/procps.c index 295048c46..b4557e797 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]) < ' ') -- cgit v1.2.3