Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Duda <deo@logos-m.ru>2001-06-20 11:44:33 +0400
committerEgor Duda <deo@logos-m.ru>2001-06-20 11:44:33 +0400
commit9cc97acbd0a601622de1198d8b56db8be48e12fb (patch)
tree5eedacd09dcd2ca0690079ceb3c7d3de6e15acec
parentae036f47c54449400fb178008094e20e70488711 (diff)
* fhandler.cc (fhandler_base::open): Work around windows bug when
CreateFile() with dwDesiredAccess == 0 called on remote share returns valid handle even if file doesn't exist.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/fhandler.cc11
2 files changed, 17 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 47a4c60c0..86341e03b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2001-06-30 Egor Duda <deo@logos-m.ru>
+
+ * fhandler.cc (fhandler_base::open): Work around windows bug when
+ CreateFile() with dwDesiredAccess == 0 called on remote share returns
+ valid handle even if file doesn't exist.
+
2001-06-20 Egor Duda <deo@logos-m.ru>
* fhandler_socket.cc (fhandler_socket::signal_secret_event): New
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index a07bc85ab..6c745c097 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -370,6 +370,17 @@ fhandler_base::open (int flags, mode_t mode)
if (get_device () == FH_SERIAL)
file_attributes |= FILE_FLAG_OVERLAPPED;
+ /* CreateFile() with dwDesiredAccess == 0 when called on remote
+ share returns some handle, even if file doesn't exist. This code
+ works around this bug. */
+ if (get_query_open () &&
+ isremote () &&
+ creation_distribution == OPEN_EXISTING &&
+ GetFileAttributes (get_win32_name ()) == (DWORD) -1)
+ {
+ set_errno (ENOENT);
+ goto done;
+ }
x = CreateFileA (get_win32_name (), access, shared,
&sec_none, creation_distribution,
file_attributes,