4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-30 19:10:36 +08:00

* path.cc (symlink_info::check): Avoid special handling for

STATUS_BUFFER_OVERFLOW when calling NtQueryDirectoryFile.
	* strace.cc (strace::vprntf): Use bigger buffer.
This commit is contained in:
Corinna Vinschen 2008-04-28 16:01:54 +00:00
parent 08c76b4b9c
commit 43657e6bd3
3 changed files with 14 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2008-04-28 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_info::check): Avoid special handling for
STATUS_BUFFER_OVERFLOW when calling NtQueryDirectoryFile.
* strace.cc (strace::vprntf): Use bigger buffer.
2008-04-28 Corinna Vinschen <corinna@vinschen.de> 2008-04-28 Corinna Vinschen <corinna@vinschen.de>
* kernel32.cc (CreateFileMappingW): Remove stray small_printf. * kernel32.cc (CreateFileMappingW): Remove stray small_printf.

View File

@ -2310,7 +2310,10 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
UNICODE_STRING dirname, basename; UNICODE_STRING dirname, basename;
OBJECT_ATTRIBUTES dattr; OBJECT_ATTRIBUTES dattr;
HANDLE dir; HANDLE dir;
FILE_DIRECTORY_INFORMATION fdi; struct {
FILE_DIRECTORY_INFORMATION fdi;
WCHAR dummy_buf[NAME_MAX + 1];
} fdi_buf;
RtlSplitUnicodePath (&upath, &dirname, &basename); RtlSplitUnicodePath (&upath, &dirname, &basename);
InitializeObjectAttributes (&dattr, &dirname, InitializeObjectAttributes (&dattr, &dirname,
@ -2328,27 +2331,18 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
else else
{ {
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io, status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
&fdi, sizeof fdi, &fdi_buf, sizeof fdi_buf,
FileDirectoryInformation, FileDirectoryInformation,
TRUE, &basename, TRUE); TRUE, &basename, TRUE);
NtClose (dir); NtClose (dir);
/* Per MSDN, ZwQueryDirectoryFile allows to specify a buffer if (!NT_SUCCESS (status))
which only fits the static parts of the structure (without
filename that is) in the first call. The buffer actually
contains valid data, even though ZwQueryDirectoryFile
returned STATUS_BUFFER_OVERFLOW.
Please note that this doesn't work for the info class
FileIdBothDirectoryInformation, unfortunately, so we don't
use this technique in fhandler_base::fstat_by_name, */
if (!NT_SUCCESS (status) && status != STATUS_BUFFER_OVERFLOW)
{ {
debug_printf ("%p = NtQueryDirectoryFile(%S)", debug_printf ("%p = NtQueryDirectoryFile(%S)",
status, &dirname); status, &dirname);
fileattr = 0; fileattr = 0;
} }
else else
fileattr = fdi.FileAttributes; fileattr = fdi_buf.fdi.FileAttributes;
} }
ext_tacked_on = !!*ext_here; ext_tacked_on = !!*ext_here;
goto file_not_symlink; goto file_not_symlink;

View File

@ -234,7 +234,7 @@ strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
int len; int len;
char buf[10000]; char buf[NT_MAX_PATH];
PROTECT (buf); PROTECT (buf);
SetLastError (err); SetLastError (err);