* fhandler_disk_file.cc (fhandler_base::fstat_helper): Workaround
another bug in NWFS. Add comment to explain why. Improve debug output in case the NT calls to test for binary fail. * path.h (path_conv::fs_is_cifs): New method. (path_conv::fs_is_nwfs): New method.
This commit is contained in:
parent
8b5c2e99d4
commit
4a49c71595
@ -1,3 +1,11 @@
|
|||||||
|
2010-02-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Workaround
|
||||||
|
another bug in NWFS. Add comment to explain why. Improve debug output
|
||||||
|
in case the NT calls to test for binary fail.
|
||||||
|
* path.h (path_conv::fs_is_cifs): New method.
|
||||||
|
(path_conv::fs_is_nwfs): New method.
|
||||||
|
|
||||||
2010-02-02 Corinna Vinschen <corinna@vinschen.de>
|
2010-02-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* include/paths.h (_PATH_MNTTAB): Define.
|
* include/paths.h (_PATH_MNTTAB): Define.
|
||||||
|
@ -659,27 +659,46 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
|||||||
if (pc.exec_state () == dont_know_if_executable)
|
if (pc.exec_state () == dont_know_if_executable)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
NTSTATUS status;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
|
|
||||||
InitializeObjectAttributes (&attr, &ro_u_empty, 0, get_handle (),
|
/* The NWFS implementation is frighteningly incomplete. When
|
||||||
NULL);
|
re-opening a file by handle, the subsequent NtReadFile
|
||||||
if (NT_SUCCESS (NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
|
returns with the weird status STATUS_FILE_IS_A_DIRECTORY.
|
||||||
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
We're still using the re-open by handle method for all
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT)))
|
other filesystems since it's 8-10% faster than opening
|
||||||
|
by name. */
|
||||||
|
if (pc.fs_is_nwfs ())
|
||||||
|
InitializeObjectAttributes (&attr, pc.get_nt_native_path (),
|
||||||
|
OBJ_CASE_INSENSITIVE, NULL, NULL)
|
||||||
|
else
|
||||||
|
InitializeObjectAttributes (&attr, &ro_u_empty, 0,
|
||||||
|
get_handle (), NULL);
|
||||||
|
status = NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
|
||||||
|
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
|
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||||
|
if (NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER off = { QuadPart:0LL };
|
LARGE_INTEGER off = { QuadPart:0LL };
|
||||||
char magic[3];
|
char magic[3];
|
||||||
|
|
||||||
if (NT_SUCCESS (NtReadFile (h, NULL, NULL, NULL, &io, magic,
|
status = NtReadFile (h, NULL, NULL, NULL, &io, magic,
|
||||||
3, &off, NULL))
|
3, &off, NULL);
|
||||||
|
if (NT_SUCCESS (status)
|
||||||
&& has_exec_chars (magic, io.Information))
|
&& has_exec_chars (magic, io.Information))
|
||||||
{
|
{
|
||||||
pc.set_exec ();
|
pc.set_exec ();
|
||||||
buf->st_mode |= STD_XBITS;
|
buf->st_mode |= STD_XBITS;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
debug_printf ("%p = NtReadFile(%S)", status,
|
||||||
|
pc.get_nt_native_path ());
|
||||||
NtClose (h);
|
NtClose (h);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
debug_printf ("%p = NtOpenFile(%S)", status,
|
||||||
|
pc.get_nt_native_path ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pc.exec_state () == is_executable)
|
if (pc.exec_state () == is_executable)
|
||||||
|
@ -234,6 +234,8 @@ class path_conv
|
|||||||
bool fs_is_netapp () const {return fs.is_netapp ();}
|
bool fs_is_netapp () const {return fs.is_netapp ();}
|
||||||
bool fs_is_cdrom () const {return fs.is_cdrom ();}
|
bool fs_is_cdrom () const {return fs.is_cdrom ();}
|
||||||
bool fs_is_mvfs () const {return fs.is_mvfs ();}
|
bool fs_is_mvfs () const {return fs.is_mvfs ();}
|
||||||
|
bool fs_is_cifs () const {return fs.is_cifs ();}
|
||||||
|
bool fs_is_nwfs () const {return fs.is_nwfs ();}
|
||||||
ULONG fs_serial_number () const {return fs.serial_number ();}
|
ULONG fs_serial_number () const {return fs.serial_number ();}
|
||||||
inline const char *set_path (const char *p)
|
inline const char *set_path (const char *p)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user