From e1a993d549f9f3047d31de7aeeaa0f49efdb738b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2000 18:45:42 +0000 Subject: * 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'. --- winsup/cygwin/fhandler.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'winsup/cygwin/fhandler.cc') 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; -- cgit v1.2.3