Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-08-26 16:06:27 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-08-26 16:06:27 +0400
commit708bbfd08e3af41be76e864e822fe5cc638f5715 (patch)
treea7476b8c177c2b08125e1881b3667afaae45fd38
parent46059af75c7681bd76fadfc2415c96c849f275fd (diff)
* cygpath.cc (get_device_name): Prefer the \\.\X: DOS device for
harddisks, if available.
-rw-r--r--winsup/utils/ChangeLog5
-rw-r--r--winsup/utils/cygpath.cc14
2 files changed, 17 insertions, 2 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 824c19b88..507ddd37f 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-26 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygpath.cc (get_device_name): Prefer the \\.\X: DOS device for
+ harddisks, if available.
+
2010-08-21 Corinna Vinschen <corinna@vinschen.de>
* ldd.cc (report): Drop long pathname considerations which result in
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
index 2ba727a9c..449c5436e 100644
--- a/winsup/utils/cygpath.cc
+++ b/winsup/utils/cygpath.cc
@@ -233,8 +233,18 @@ get_device_name (char *path)
ans.MaximumLength = len;
ans.Buffer = ret + 4;
RtlUnicodeStringToAnsiString (&ans, &odi->ObjectName, FALSE);
- ZwClose (dir);
- goto out;
+ /* Special case for local disks: It's most feasible if the
+ DOS device name reflects the DOS drive, so we check for this
+ explicitly and only return prematurely if so. */
+#define HARDDISK_PREFIX L"\\Device\\Harddisk"
+ if (ntdev.Length < wcslen (HARDDISK_PREFIX)
+ || wcsncasecmp (ntdev.Buffer, HARDDISK_PREFIX, 8) != 0
+ || (odi->ObjectName.Length == 2 * sizeof (WCHAR)
+ && odi->ObjectName.Buffer[1] == L':'))
+ {
+ ZwClose (dir);
+ goto out;
+ }
}
}
ZwClose (dir);