2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Better comment about EOVERFLOW and pstat_getproc().

Also remove some useless casts.
This commit is contained in:
Todd C. Miller
2019-03-06 20:15:11 -07:00
parent 17ca31c381
commit 0766e0c647
2 changed files with 6 additions and 4 deletions

View File

@@ -276,9 +276,10 @@ get_starttime(pid_t pid, struct timespec *starttime)
/*
* Determine the start time from pst_start in struct pst_status.
* We may get EOVERFLOW if the whole thing doesn't fit but that is OK.
* EOVERFLOW is not a fatal error for the fields we use.
* See the "EOVERFLOW Error" section of pstat_getvminfo(3).
*/
rc = pstat_getproc(&pstat, sizeof(pstat), (size_t)0, (int)pid);
rc = pstat_getproc(&pstat, sizeof(pstat), 0, pid);
if (rc != -1 || errno == EOVERFLOW) {
starttime->tv_sec = pstat.pst_start;
starttime->tv_nsec = 0;

View File

@@ -284,9 +284,10 @@ get_process_ttyname(char *name, size_t namelen)
/*
* Determine the tty from psdev in struct pst_status.
* We may get EOVERFLOW if the whole thing doesn't fit but that is OK.
* EOVERFLOW is not a fatal error for the fields we use.
* See the "EOVERFLOW Error" section of pstat_getvminfo(3).
*/
rc = pstat_getproc(&pstat, sizeof(pstat), (size_t)0, (int)getpid());
rc = pstat_getproc(&pstat, sizeof(pstat), 0, getpid());
if (rc != -1 || errno == EOVERFLOW) {
if (pstat.pst_term.psd_major != -1 && pstat.pst_term.psd_minor != -1) {
errno = serrno;