top/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 @@
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]) < ' ')