aboutsummaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 8946917a2..6e6412bb1 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -385,16 +385,15 @@ procps_status_t *procps_scan(procps_status_t* sp, int flags)
385 n = read_to_buf(filename, buf); 385 n = read_to_buf(filename, buf);
386 if (n <= 0) 386 if (n <= 0)
387 break; 387 break;
388#if ENABLE_PGREP || ENABLE_PKILL
389 if (flags & PSSCAN_ARGVN) { 388 if (flags & PSSCAN_ARGVN) {
390 do { 389 sp->argv_len = n;
391 n--; 390 sp->argv0 = xmalloc(n + 1);
392 if (buf[n] == '\0') 391 memcpy(sp->argv0, buf, n + 1);
393 buf[n] = ' '; 392 /* sp->argv0[n] = '\0'; - buf has it */
394 } while (n); 393 } else {
394 sp->argv_len = 0;
395 sp->argv0 = xstrdup(buf);
395 } 396 }
396#endif
397 sp->argv0 = xstrdup(buf);
398 } 397 }
399#endif 398#endif
400 break; 399 break;