summaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 307d8d6..9a8e42d 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -471,6 +471,8 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
sz = open_read_close(filename, buf, col);
if (sz > 0) {
buf[sz] = '\0';
+ while (--sz >= 0 && buf[sz] == '\0')
+ continue;
while (--sz >= 0)
if ((unsigned char)(buf[sz]) < ' ')
buf[sz] = ' ';