From 17ca31c38113dd996ea0877637b82c95f52f587b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 6 Mar 2019 20:13:40 -0700 Subject: [PATCH] Ignore EOVERFLOW from pstat_getproc(), it is not a fatal error. It just means that one of the fields in pstat lacks the precision to store a value. That's not an issue for pst_highestfd. --- lib/util/closefrom.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/util/closefrom.c b/lib/util/closefrom.c index 6cfe3204f..106925b9e 100644 --- a/lib/util/closefrom.c +++ b/lib/util/closefrom.c @@ -91,7 +91,12 @@ sudo_closefrom(int lowfd) return; #endif #if defined(HAVE_PSTAT_GETPROC) - if (pstat_getproc(&pstat, sizeof(pstat), 0, getpid()) != -1) { + /* + * EOVERFLOW is not a fatal error for the fields we use. + * See the "EOVERFLOW Error" section of pstat_getvminfo(3). + */ + if (pstat_getproc(&pstat, sizeof(pstat), 0, getpid()) != -1 || + errno == EOVERFLOW) { int fd; for (fd = lowfd; fd <= pstat.pst_highestfd; fd++) -- 2.40.0