Add closefrom call to RunProcess

This commit is contained in:
Jack Andersen 2019-02-26 19:13:19 -10:00
parent 6626557cc4
commit 1f04f7ae12
6 changed files with 9 additions and 10 deletions

View File

@ -9,6 +9,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/statvfs.h>
#if __linux__ || __APPLE__
extern "C" int rep_closefrom(int lower);
#define closefrom rep_closefrom
#endif
#else
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1

View File

@ -3,8 +3,4 @@ set(BLENDER_SOURCES
SDNARead.cpp
HMDL.cpp)
if(UNIX)
list(APPEND BLENDER_SOURCES closefrom.c)
endif()
hecl_add_list(Blender BLENDER_SOURCES)

View File

@ -20,12 +20,6 @@
#if _WIN32
#include <io.h>
#include <fcntl.h>
#else
#include <unistd.h>
#if __linux__ || __APPLE__
extern "C" int rep_closefrom(int lower);
#define closefrom rep_closefrom
#endif
#endif
#undef min

View File

@ -75,6 +75,10 @@ set(COMMON_SOURCES
atdna_Frontend.cpp
atdna_CVar.cpp)
if(UNIX)
list(APPEND PLAT_SRCS closefrom.c)
endif()
add_library(hecl-full
${BACKEND_SOURCES}
${FRONTEND_SOURCES}

View File

@ -853,6 +853,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
#else
pid_t pid = fork();
if (!pid) {
closefrom(3);
execvp(path, (char* const*)args);
exit(1);
}