summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2000-11-28 18:45:42 +0000
committerCorinna Vinschen <corinna@vinschen.de>2000-11-28 18:45:42 +0000
commite1a993d549f9f3047d31de7aeeaa0f49efdb738b (patch)
tree3335f8ca3aa14f96ec1c1e01c10d1723b5ed1736 /winsup/cygwin/fhandler.cc
parent91797c6d8e6b2fbb4bb652aab2087ea6d7b09c00 (diff)
downloadcygnal-e1a993d549f9f3047d31de7aeeaa0f49efdb738b.tar.gz
cygnal-e1a993d549f9f3047d31de7aeeaa0f49efdb738b.tar.bz2
cygnal-e1a993d549f9f3047d31de7aeeaa0f49efdb738b.zip
* fhandler.cc (fhandler_disk_file::open): Check for buggy CreateFile
condition. * path.cc (path_conv::check): Get file system type in call to GetVolumeInformation to check for file systems with buggy CreateFile. * path.h (enum path_types): Add PATH_HASBUGGYOPEN. (class path_conv): Add methods `has_buggy_open' and `set_has_buggy_open'.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index ed0ebb42f..d2480df17 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1238,6 +1238,21 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode)
if (!res)
goto out;
+ /* This is for file systems known for having a buggy CreateFile call
+ which might return a valid HANDLE without having actually opened
+ the file.
+ The only known file system to date is the SUN NFS Solstice Client 3.1
+ which returns a valid handle when trying to open a file in a non
+ existant directory. */
+ if (real_path.has_buggy_open ()
+ && GetFileAttributes (win32_path_name_) == (DWORD) -1)
+ {
+ debug_printf ("Buggy open detected.");
+ close ();
+ set_errno (ENOENT);
+ return 0;
+ }
+
extern BOOL allow_ntea;
extern BOOL allow_ntsec;