From e45f2d6deae95d618f999a5091300b45fe45a176 Mon Sep 17 00:00:00 2001 From: Nicolas Duteil Date: Thu, 11 Sep 2025 00:58:13 +0200 Subject: [PATCH] fix: remove "#if defined(HAVE_CLOSEFROM)" --- quickjs-libc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/quickjs-libc.c b/quickjs-libc.c index 860c835..6317ca4 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3112,6 +3112,7 @@ static JSValue js_os_exec(JSContext *ctx, JSValueConst this_val, } if (pid == 0) { /* child */ + int fd_max = sysconf(_SC_OPEN_MAX); /* remap the stdin/stdout/stderr handles if necessary */ for(i = 0; i < 3; i++) { @@ -3120,12 +3121,6 @@ static JSValue js_os_exec(JSContext *ctx, JSValueConst this_val, _exit(127); } } -#if defined(HAVE_CLOSEFROM) - /* closefrom() is available on many recent unix systems: - Linux with glibc 2.34+, Solaris 9+, FreeBSD 7.3+, - NetBSD 3.0+, OpenBSD 3.5+. - Linux with the musl libc and macOS don't have it. - */ #if defined(__linux__) int pid = getpid();