From 622a47367a0e9cff920c315964c2070059716e9a Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 20 May 2009 13:09:26 +0000 Subject: [PATCH] add _O_NOINHERIT when opening files on Windows (see #2650) --- include/HsBase.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/HsBase.h b/include/HsBase.h index b749c58..afbff12 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -688,9 +688,11 @@ INLINE int __hscore_hs_fileno (FILE *f) { return fileno (f); } INLINE int __hscore_open(char *file, int how, mode_t mode) { #ifdef __MINGW32__ if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND)) - return _sopen(file,how,_SH_DENYRW,mode); + return _sopen(file,how | _O_NOINHERIT,_SH_DENYRW,mode); + // _O_NOINHERIT: see #2650 else - return _sopen(file,how,_SH_DENYWR,mode); + return _sopen(file,how | _O_NOINHERIT,_SH_DENYWR,mode); + // _O_NOINHERIT: see #2650 #else return open(file,how,mode); #endif -- 1.7.10.4