@@ -91,10 +91,13 @@ #endif #ifndef O_BINARY # define O_BINARY 0 #endif +#ifndef O_CLOEXEC +# define O_CLOEXEC 0 +#endif #ifndef O_EXLOCK # define O_EXLOCK 0 #endif #ifndef S_IRGRP @@ -888,10 +891,12 @@ @try { int flags; if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; + + flags |= O_CLOEXEC; #ifndef _WIN32 if ((_fd = open([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], flags, DEFAULT_MODE)) == -1) #else