From 0766e0c6470bb13cfa33051fc654c7608c6aa18f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 6 Mar 2019 20:15:11 -0700 Subject: [PATCH] Better comment about EOVERFLOW and pstat_getproc(). Also remove some useless casts. --- plugins/sudoers/starttime.c | 5 +++-- src/ttyname.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/sudoers/starttime.c b/plugins/sudoers/starttime.c index c2fe0f4a5..8bc526b4e 100644 --- a/plugins/sudoers/starttime.c +++ b/plugins/sudoers/starttime.c @@ -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; diff --git a/src/ttyname.c b/src/ttyname.c index adb19e5c7..d1b78d4bf 100644 --- a/src/ttyname.c +++ b/src/ttyname.c @@ -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; -- 2.40.0