summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-04-28 16:01:54 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-04-28 16:01:54 +0000
commit43657e6bd3d292a6efb6b4a218101d430bfed03d (patch)
tree348502d79721f6fbf0b2d53c198c4d1c43950d50 /winsup/cygwin/path.cc
parent08c76b4b9c7029b5d8eac8763304417de97f5a25 (diff)
downloadcygnal-43657e6bd3d292a6efb6b4a218101d430bfed03d.tar.gz
cygnal-43657e6bd3d292a6efb6b4a218101d430bfed03d.tar.bz2
cygnal-43657e6bd3d292a6efb6b4a218101d430bfed03d.zip
* path.cc (symlink_info::check): Avoid special handling for
STATUS_BUFFER_OVERFLOW when calling NtQueryDirectoryFile. * strace.cc (strace::vprntf): Use bigger buffer.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc20
1 files changed, 7 insertions, 13 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 2970c16b8..ef4ebec51 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2310,7 +2310,10 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
UNICODE_STRING dirname, basename;
OBJECT_ATTRIBUTES dattr;
HANDLE dir;
- FILE_DIRECTORY_INFORMATION fdi;
+ struct {
+ FILE_DIRECTORY_INFORMATION fdi;
+ WCHAR dummy_buf[NAME_MAX + 1];
+ } fdi_buf;
RtlSplitUnicodePath (&upath, &dirname, &basename);
InitializeObjectAttributes (&dattr, &dirname,
@@ -2328,27 +2331,18 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
else
{
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
- &fdi, sizeof fdi,
+ &fdi_buf, sizeof fdi_buf,
FileDirectoryInformation,
TRUE, &basename, TRUE);
NtClose (dir);
- /* Per MSDN, ZwQueryDirectoryFile allows to specify a buffer
- 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)
+ if (!NT_SUCCESS (status))
{
debug_printf ("%p = NtQueryDirectoryFile(%S)",
status, &dirname);
fileattr = 0;
}
else
- fileattr = fdi.FileAttributes;
+ fileattr = fdi_buf.fdi.FileAttributes;
}
ext_tacked_on = !!*ext_here;
goto file_not_symlink;