* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fetch number

of links and inode number only if path has good inodes.
	(fhandler_base::fstat_by_name): Fetch inode number only if path has
	good inodes.
This commit is contained in:
Corinna Vinschen 2010-09-15 11:26:10 +00:00
parent f859880a5b
commit 421ff3ff77
2 changed files with 27 additions and 14 deletions

View File

@ -1,3 +1,10 @@
2010-09-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fetch number
of links and inode number only if path has good inodes.
(fhandler_base::fstat_by_name): Fetch inode number only if path has
good inodes.
2010-09-14 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_info::check): Make sure AllocationSize and EndOfFile

View File

@ -356,6 +356,10 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
NTSTATUS status = 0;
IO_STATUS_BLOCK io;
if (!pc.hasgood_inode ())
fsi.NumberOfLinks = 1;
else
{
status = NtQueryInformationFile (h, &io, &fsi, sizeof fsi,
FileStandardInformation);
if (!NT_SUCCESS (status))
@ -364,7 +368,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
status, pc.get_nt_native_path ());
return -1;
}
if (!ino && pc.hasgood_inode ())
if (!ino)
{
status = NtQueryInformationFile (h, &io, &fii, sizeof fii,
FileInternalInformation);
@ -376,6 +380,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
}
ino = fii.FileId.QuadPart;
}
}
return fstat_helper (buf, fsi.NumberOfLinks);
}
@ -393,7 +398,8 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
WCHAR buf[NAME_MAX + 1];
} fdi_buf;
if (!ino && wincap.has_fileid_dirinfo () && !pc.has_buggy_fileid_dirinfo ())
if (!ino && pc.hasgood_inode ()
&& wincap.has_fileid_dirinfo () && !pc.has_buggy_fileid_dirinfo ())
{
RtlSplitUnicodePath (pc.get_nt_native_path (), &dirname, &basename);
InitializeObjectAttributes (&attr, &dirname, pc.objcaseinsensitive (),