From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A0E734696C4 for ; Mon, 2 Mar 2020 23:13:06 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id x7so944245ljc.1 for ; Mon, 02 Mar 2020 12:13:06 -0800 (PST) From: Cyrill Gorcunov Date: Mon, 2 Mar 2020 23:12:23 +0300 Message-Id: <20200302201227.31785-4-gorcunov@gmail.com> In-Reply-To: <20200302201227.31785-1-gorcunov@gmail.com> References: <20200302201227.31785-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 3/7] popen: close_inherited_fds - add support for macos/freebsd List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Signed-off-by: Cyrill Gorcunov --- src/lib/core/popen.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c index 0e2d9dd00..ce7d7fff7 100644 --- a/src/lib/core/popen.c +++ b/src/lib/core/popen.c @@ -529,8 +529,11 @@ make_pipe(int pfd[2]) static int close_inherited_fds(int *skip_fds, size_t nr_skip_fds) { -#ifdef TARGET_OS_LINUX +# if defined(TARGET_OS_LINUX) static const char path[] = "/proc/self/fd"; +# else + static const char path[] = "/dev/fd"; +# endif struct dirent *de; int fd_no, fd_dir; DIR *dir; @@ -577,17 +580,6 @@ close_inherited_fds(int *skip_fds, size_t nr_skip_fds) diag_set(SystemError, "fdin: Can't close %s", path); return -1; } -#else - /* FIXME: What about FreeBSD/MachO? */ - (void)skip_fds; - (void)nr_skip_fds; - - static bool said = false; - if (!said) { - say_warn("popen: fdin: Skip closing inherited"); - said = true; - } -#endif return 0; } -- 2.20.1