From 041bf4ebba1c2ac10e50374e61039d8fed9b7e80 Mon Sep 17 00:00:00 2001 From: albert <> Date: Sat, 7 Dec 2002 08:34:03 +0000 Subject: [PATCH] stop chopping cmd off short --- proc/readproc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proc/readproc.c b/proc/readproc.c index 6ed06620..83ef66aa 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -182,8 +182,7 @@ static void stat2proc(const char* S, proc_t *restrict P) { S = tmp + 2; tmp = strrchr(S, ')'); // split into "PID (cmd" and "" num = tmp - S; - if(unlikely(num > sizeof P->cmd)) num = sizeof P->cmd; // 1 too big - num--; // ditch the ')' character + if(unlikely(num >= sizeof P->cmd)) num = sizeof P->cmd - 1; memcpy(P->cmd, S, num); P->cmd[num] = '\0'; S = tmp + 2; // skip ") "