* 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'.
This commit is contained in:
parent
91797c6d8e
commit
e1a993d549
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Nov 28 18:08:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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'.
|
||||||
|
|
||||||
Sun Nov 26 16:26:14 2000 Christopher Faylor <cgf@cygnus.com>
|
Sun Nov 26 16:26:14 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* fhandler.cc (is_at_eof): New function.
|
* fhandler.cc (is_at_eof): New function.
|
||||||
|
|
|
@ -1238,6 +1238,21 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode)
|
||||||
if (!res)
|
if (!res)
|
||||||
goto out;
|
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_ntea;
|
||||||
extern BOOL allow_ntsec;
|
extern BOOL allow_ntsec;
|
||||||
|
|
||||||
|
|
|
@ -389,20 +389,26 @@ out:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DWORD serial, volflags;
|
DWORD serial, volflags;
|
||||||
|
char fs_name[16];
|
||||||
|
|
||||||
strcpy (tmp_buf, full_path);
|
strcpy (tmp_buf, full_path);
|
||||||
if (!rootdir (tmp_buf) ||
|
if (!rootdir (tmp_buf) ||
|
||||||
!GetVolumeInformation (tmp_buf, NULL, 0, &serial, NULL, &volflags, NULL, 0))
|
!GetVolumeInformation (tmp_buf, NULL, 0, &serial, NULL,
|
||||||
|
&volflags, fs_name, 16))
|
||||||
{
|
{
|
||||||
debug_printf ("GetVolumeInformation(%s) = ERR, full_path(%s), set_has_acls(FALSE)",
|
debug_printf ("GetVolumeInformation(%s) = ERR, full_path(%s), set_has_acls(FALSE)",
|
||||||
tmp_buf, full_path, GetLastError ());
|
tmp_buf, full_path, GetLastError ());
|
||||||
set_has_acls (FALSE);
|
set_has_acls (FALSE);
|
||||||
|
set_has_buggy_open (FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_printf ("GetVolumeInformation(%s) = OK, full_path(%s), set_has_acls(%d)",
|
debug_printf ("GetVolumeInformation(%s) = OK, full_path(%s), set_has_acls(%d)",
|
||||||
tmp_buf, full_path, volflags & FS_PERSISTENT_ACLS);
|
tmp_buf, full_path, volflags & FS_PERSISTENT_ACLS);
|
||||||
set_has_acls (volflags & FS_PERSISTENT_ACLS);
|
set_has_acls (volflags & FS_PERSISTENT_ACLS);
|
||||||
|
/* Known file systems with buggy open calls. Further explanation
|
||||||
|
in fhandler.cc (fhandler_disk_file::open). */
|
||||||
|
set_has_buggy_open (strcmp (fs_name, "SUNWNFS") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -37,6 +37,7 @@ enum path_types
|
||||||
PATH_EXEC = MOUNT_EXEC,
|
PATH_EXEC = MOUNT_EXEC,
|
||||||
PATH_CYGWIN_EXEC = MOUNT_CYGWIN_EXEC,
|
PATH_CYGWIN_EXEC = MOUNT_CYGWIN_EXEC,
|
||||||
PATH_ALL_EXEC = PATH_CYGWIN_EXEC | PATH_EXEC,
|
PATH_ALL_EXEC = PATH_CYGWIN_EXEC | PATH_EXEC,
|
||||||
|
PATH_HASBUGGYOPEN = 0x20000000,
|
||||||
PATH_SOCKET = 0x40000000,
|
PATH_SOCKET = 0x40000000,
|
||||||
PATH_HASACLS = 0x80000000
|
PATH_HASACLS = 0x80000000
|
||||||
};
|
};
|
||||||
|
@ -50,6 +51,7 @@ class path_conv
|
||||||
|
|
||||||
int has_acls () {return path_flags & PATH_HASACLS;}
|
int has_acls () {return path_flags & PATH_HASACLS;}
|
||||||
int hasgood_inode () {return path_flags & PATH_HASACLS;} // Not strictly correct
|
int hasgood_inode () {return path_flags & PATH_HASACLS;} // Not strictly correct
|
||||||
|
int has_buggy_open () {return path_flags & PATH_HASBUGGYOPEN;}
|
||||||
int isbinary () {return path_flags & PATH_BINARY;}
|
int isbinary () {return path_flags & PATH_BINARY;}
|
||||||
int issymlink () {return path_flags & PATH_SYMLINK;}
|
int issymlink () {return path_flags & PATH_SYMLINK;}
|
||||||
int issocket () {return path_flags & PATH_SOCKET;}
|
int issocket () {return path_flags & PATH_SOCKET;}
|
||||||
|
@ -60,6 +62,7 @@ class path_conv
|
||||||
void set_symlink () {path_flags |= PATH_SYMLINK;}
|
void set_symlink () {path_flags |= PATH_SYMLINK;}
|
||||||
void set_exec (int x = 1) {path_flags |= x ? PATH_EXEC : PATH_NOTHING;}
|
void set_exec (int x = 1) {path_flags |= x ? PATH_EXEC : PATH_NOTHING;}
|
||||||
void set_has_acls (int x = 1) {path_flags |= x ? PATH_HASACLS : PATH_NOTHING;}
|
void set_has_acls (int x = 1) {path_flags |= x ? PATH_HASACLS : PATH_NOTHING;}
|
||||||
|
void set_has_buggy_open (int x = 1) {path_flags |= x ? PATH_HASBUGGYOPEN : PATH_NOTHING;}
|
||||||
|
|
||||||
char *known_suffix;
|
char *known_suffix;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue