Skip to content

Commit

Permalink
mx_proc: Reduce linebuf size to 64 and fix comment
Browse files Browse the repository at this point in the history
> pid + " (" comm + ") " + state + " " + pid + " \0"
> 10 + 2 + 15 + 2 + 1 + 1 + 10 + 2 = 43

Found-by: Donald
  • Loading branch information
pmenzel committed Dec 17, 2021
1 parent 03bd205 commit 1731eaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mx_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ pid_t mx_proc_get_parent(pid_t pid) {
FILE *statfile;
pid_t parent;
int n;
char linebuf[256]; // "2147483647 (max128chars) X 2147483647 " = 156
char linebuf[64]; // "2147483647 (max15chars) X 2147483647 " = 43

if (pid == 0) // no need to try /proc/0/stat
return -1;
Expand Down

0 comments on commit 1731eaf

Please sign in to comment.