early-access version 2853
This commit is contained in:
34
externals/vcpkg/ports/physfs/003-fix-posix-cloexec.patch
vendored
Executable file
34
externals/vcpkg/ports/physfs/003-fix-posix-cloexec.patch
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
diff --git a/src/physfs_platform_posix.c b/src/physfs_platform_posix.c
|
||||
--- a/src/physfs_platform_posix.c
|
||||
+++ b/src/physfs_platform_posix.c
|
||||
@@ -160,16 +160,30 @@ static void *doOpen(const char *filename, int mode)
|
||||
const int appending = (mode & O_APPEND);
|
||||
int fd;
|
||||
int *retval;
|
||||
+ int flags;
|
||||
+ flags = -1;
|
||||
errno = 0;
|
||||
|
||||
/* O_APPEND doesn't actually behave as we'd like. */
|
||||
mode &= ~O_APPEND;
|
||||
+
|
||||
+#ifdef O_CLOEXEC
|
||||
+ /* Add O_CLOEXEC if defined */
|
||||
+ mode |= O_CLOEXEC;
|
||||
+#endif
|
||||
|
||||
do {
|
||||
fd = open(filename, mode, S_IRUSR | S_IWUSR);
|
||||
} while ((fd < 0) && (errno == EINTR));
|
||||
BAIL_IF(fd < 0, errcodeFromErrno(), NULL);
|
||||
|
||||
+#if !defined(O_CLOEXEC) && defined(FD_CLOEXEC)
|
||||
+ flags = fcntl(fd, F_GETFD);
|
||||
+ if (flags != -1) {
|
||||
+ fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (appending)
|
||||
{
|
||||
if (lseek(fd, 0, SEEK_END) < 0)
|
||||
Reference in New Issue
Block a user