Skip to content

Commit d73886e

Browse files
committed
pass O_CLOEXEC in ios_file. closes JuliaLang#11399
1 parent 14af2d1 commit d73886e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/support/ios.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,9 @@ ios_t *ios_file(ios_t *s, const char *fname, int rd, int wr, int create, int tru
853853
if (!wlen) goto open_file_err;
854854
wchar_t *fname_w = (wchar_t*)alloca(wlen*sizeof(wchar_t));
855855
if (!MultiByteToWideChar(CP_UTF8, 0, fname, -1, fname_w, wlen)) goto open_file_err;
856-
fd = _wopen(fname_w, flags | O_BINARY, _S_IREAD | _S_IWRITE);
856+
fd = _wopen(fname_w, flags | O_BINARY | O_NOINHERIT, _S_IREAD | _S_IWRITE);
857857
#else
858-
fd = open(fname, flags, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */);
858+
fd = open(fname, flags | O_CLOEXEC, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */);
859859
#endif
860860
s = ios_fd(s, fd, 1, 1);
861861
if (fd == -1)

0 commit comments

Comments
 (0)