summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-08-14 15:54:45 +0000
committerCorinna Vinschen <corinna@vinschen.de>2007-08-14 15:54:45 +0000
commitcb8e4b58f566cbef94e61c1776a14f025c064220 (patch)
treed23c07e76ba777c5314a89f0dd9c42e7ee06b340 /winsup/cygwin/path.cc
parent4a971ce403ee1dba9d779219310043816a4c4768 (diff)
downloadcygnal-cb8e4b58f566cbef94e61c1776a14f025c064220.tar.gz
cygnal-cb8e4b58f566cbef94e61c1776a14f025c064220.tar.bz2
cygnal-cb8e4b58f566cbef94e61c1776a14f025c064220.zip
* path.cc (fs_info::update): Correctly handle the volume root directory.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc7
1 files changed, 5 insertions, 2 deletions
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);
}