Changeset 33103 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Oct 13, 2010 12:46:32 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66634
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
r31717 r33103 139 139 fOpenMode |= O_NOINHERIT; 140 140 #endif 141 #ifdef O_CLOEXEC 142 static int s_fHave_O_CLOEXEC = 0; /* {-1,0,1}; since Linux 2.6.23 */ 143 if (!(fOpen & RTFILE_O_INHERIT) && s_fHave_O_CLOEXEC >= 0) 144 fOpenMode |= O_CLOEXEC; 145 #endif 141 146 #ifdef O_NONBLOCK 142 147 if (fOpen & RTFILE_O_NON_BLOCK) … … 202 207 int fh = open(pszNativeFilename, fOpenMode, fMode); 203 208 int iErr = errno; 209 210 #ifdef O_CLOEXEC 211 if ( (fOpenMode & O_CLOEXEC) 212 && s_fHave_O_CLOEXEC == 0) 213 { 214 if (fh < 0 && iErr == EINVAL) 215 { 216 s_fHave_O_CLOEXEC = -1; 217 fh = open(pszNativeFilename, fOpenMode, fMode); 218 iErr = errno; 219 } 220 else if (fh >= 0) 221 s_fHave_O_CLOEXEC = fcntl(fh, F_GETFD, 0) > 0 ? 1 : -1; 222 } 223 #endif 224 204 225 rtPathFreeNative(pszNativeFilename, pszFilename); 205 226 if (fh >= 0) … … 213 234 #ifdef O_NOINHERIT 214 235 && !(fOpenMode & O_NOINHERIT) /* Take care since it might be a zero value dummy. */ 236 #endif 237 #ifdef O_CLOEXEC 238 && s_fHave_O_CLOEXEC <= 0 215 239 #endif 216 240 )
Note:
See TracChangeset
for help on using the changeset viewer.