Implement controls for file descriptor inheritance
[libs/core.git] / source / io / unix / file.cpp
index b2c9089a8d6ecdf108aee88ec30ab38b7b6732bd..6092cb740172365d878be540121abf565582a949 100644 (file)
@@ -35,6 +35,8 @@ void File::platform_init(const string &fn, CreateMode cm)
                flags |= O_APPEND;
        if(mode&M_NONBLOCK)
                flags |= O_NONBLOCK;
+       if(!(mode&M_INHERIT))
+               flags |= O_CLOEXEC;
 
        *handle = ::open(fn.c_str(), flags, 0666);
        if(!handle)