stop chopping cmd off short
This commit is contained in:
parent
7439aa80ce
commit
041bf4ebba
@ -182,8 +182,7 @@ static void stat2proc(const char* S, proc_t *restrict P) {
|
|||||||
S = tmp + 2;
|
S = tmp + 2;
|
||||||
tmp = strrchr(S, ')'); // split into "PID (cmd" and "<rest>"
|
tmp = strrchr(S, ')'); // split into "PID (cmd" and "<rest>"
|
||||||
num = tmp - S;
|
num = tmp - S;
|
||||||
if(unlikely(num > sizeof P->cmd)) num = sizeof P->cmd; // 1 too big
|
if(unlikely(num >= sizeof P->cmd)) num = sizeof P->cmd - 1;
|
||||||
num--; // ditch the ')' character
|
|
||||||
memcpy(P->cmd, S, num);
|
memcpy(P->cmd, S, num);
|
||||||
P->cmd[num] = '\0';
|
P->cmd[num] = '\0';
|
||||||
S = tmp + 2; // skip ") "
|
S = tmp + 2; // skip ") "
|
||||||
|
Loading…
Reference in New Issue
Block a user