reactos/lib/msvcrt/io
diff -u -r1.18 -r1.19
--- open.c 15 Aug 2004 18:16:36 -0000 1.18
+++ open.c 31 Aug 2004 20:07:06 -0000 1.19
@@ -1,4 +1,4 @@
-/* $Id: open.c,v 1.18 2004/08/15 18:16:36 chorns Exp $
+/* $Id: open.c,v 1.19 2004/08/31 20:07:06 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -141,11 +141,6 @@
else //if ((_oflag & O_RDONLY) == O_RDONLY)
dwDesiredAccess |= GENERIC_READ;
#endif
- if (( _oflag & S_IREAD ) == S_IREAD)
- dwShareMode |= FILE_SHARE_READ;
-
- if (( _oflag & S_IWRITE ) == S_IWRITE)
- dwShareMode |= FILE_SHARE_WRITE;
if (( _oflag & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
dwCreationDistribution |= CREATE_NEW;
@@ -177,6 +172,13 @@
}
if (_oflag & _O_NOINHERIT)
sa.bInheritHandle = FALSE;
+
+ if (dwCreationDistribution == OPEN_EXISTING &&
+ (dwDesiredAccess & (GENERIC_WRITE|GENERIC_READ)) == GENERIC_READ) {
+ /* Allow always shared read for a file which is opened for read only */
+ dwShareMode |= FILE_SHARE_READ;
+ }
+
hFile = CreateFileA(_path,
dwDesiredAccess,
dwShareMode,