summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-03-04 13:54:59 +0000
committerCorinna Vinschen <corinna@vinschen.de>2005-03-04 13:54:59 +0000
commit0f63e6247d6fb47580ae24200279f7c23bb9a22e (patch)
treec8f20e2c59ef7458efa312299fad65c951e46835 /winsup/cygwin/fhandler.cc
parentf317a917bc7e669a130893db5dc32a7d620662ad (diff)
downloadcygnal-0f63e6247d6fb47580ae24200279f7c23bb9a22e.tar.gz
cygnal-0f63e6247d6fb47580ae24200279f7c23bb9a22e.tar.bz2
cygnal-0f63e6247d6fb47580ae24200279f7c23bb9a22e.zip
* fhandler.cc (fhandler_base::open_9x): Satisfy query_open values.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index b2bacb5d3..046e81fd7 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -449,12 +449,25 @@ fhandler_base::open_9x (int flags, mode_t mode)
syscall_printf ("(%s, %p)", get_win32_name (), flags);
- if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
- access = GENERIC_READ;
- else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
- access = GENERIC_WRITE;
- else
- access = GENERIC_READ | GENERIC_WRITE;
+ switch (query_open ())
+ {
+ case query_read_control:
+ case query_stat_control:
+ access = GENERIC_READ;
+ break;
+ case query_write_control:
+ case query_write_attributes:
+ access = GENERIC_READ | FILE_WRITE_ATTRIBUTES;
+ break;
+ default:
+ if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
+ access = GENERIC_READ;
+ else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
+ access = GENERIC_WRITE;
+ else
+ access = GENERIC_READ | GENERIC_WRITE;
+ break;
+ }
if ((flags & O_TRUNC) && ((flags & O_ACCMODE) != O_RDONLY))
{