From 30a56af6ef885a3d6816ef74aa34e218b0aa93c0 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 26 Apr 2019 15:21:29 -0600 Subject: [PATCH] FreeBSD's /dev/fd only contains fds 0-2 unless fdescfs is mounted. In practice this doesn't matter since FreeBSD >= 8 has a native closefrom --- lib/util/closefrom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util/closefrom.c b/lib/util/closefrom.c index 106925b9e..7f773a2e1 100644 --- a/lib/util/closefrom.c +++ b/lib/util/closefrom.c @@ -104,8 +104,8 @@ sudo_closefrom(int lowfd) return; } #elif defined(HAVE_DIRFD) - /* Use /proc/self/fd (or /dev/fd on FreeBSD) if it exists. */ -# if defined(__FreeBSD__) || defined(__APPLE__) + /* Use /proc/self/fd (or /dev/fd on macOS) if it exists. */ +# ifdef __APPLE__ path = _PATH_DEV "fd"; # else path = "/proc/self/fd"; -- 2.40.0