From cb8e4b58f566cbef94e61c1776a14f025c064220 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Aug 2007 15:54:45 +0000 Subject: * path.cc (fs_info::update): Correctly handle the volume root directory. --- winsup/cygwin/path.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 8a8064ef6..88747dbd9 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -393,17 +393,20 @@ fs_info::update (PUNICODE_STRING upath, bool exists) if (exists) status = NtOpenFile (&vol, READ_CONTROL, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); - while (!NT_SUCCESS (status) && attr.ObjectName->Length > 6 * sizeof (WCHAR)) + while (!NT_SUCCESS (status) + && (attr.ObjectName->Length > 7 * sizeof (WCHAR) + || status == STATUS_NO_MEDIA_IN_DEVICE)) { UNICODE_STRING dir; RtlSplitUnicodePath (attr.ObjectName, &dir, NULL); - dir.Length -= sizeof (WCHAR); attr.ObjectName = &dir; if (status == STATUS_NO_MEDIA_IN_DEVICE) { no_media = true; dir.Length = 6 * sizeof (WCHAR); } + else if (dir.Length > 7 * sizeof (WCHAR)) + dir.Length -= sizeof (WCHAR); status = NtOpenFile (&vol, READ_CONTROL, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); } -- cgit v1.2.3