2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Fix getting ppid in get_process_ttyname for Linux.

The ppid field in /proc/self/stat is the fourth and not the third.
The latter is the process state (S, R, etc.).

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
This commit is contained in:
Ignacy Gawędzki 2025-01-15 11:58:27 +01:00 committed by Todd C. Miller
parent 01b1410d61
commit 5794e511da

View File

@ -301,7 +301,7 @@ get_process_ttyname(char *name, size_t namelen)
} }
break; break;
} }
if (field == 3) { if (field == 4) {
ppid = ppid =
(int)sudo_strtonum(cp, INT_MIN, INT_MAX, NULL); (int)sudo_strtonum(cp, INT_MIN, INT_MAX, NULL);
} }