]> granicus.if.org Git - sudo/commitdiff
Better comment about EOVERFLOW and pstat_getproc().
authorTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 7 Mar 2019 03:15:11 +0000 (20:15 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 7 Mar 2019 03:15:11 +0000 (20:15 -0700)
Also remove some useless casts.

plugins/sudoers/starttime.c
src/ttyname.c

index c2fe0f4a568214977ebe9bf3bbd3bc0f988279d8..8bc526b4e3d885514baffe0c2f98f38179311c87 100644 (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;
index adb19e5c773934193c3582d428f25c1cc6a6b728..d1b78d4bffaa85773f1b9789303cc5e8140519e4 100644 (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;