summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2008-08-30 10:55:45 +0000
committerEli Zaretskii <eliz@gnu.org>2008-08-30 10:55:45 +0000
commit70d7ae36dd2b57b5023dca4cfc48a3d5533ab82c (patch)
treeb64acf41136c5dca06662ad0664646ba9635eaf5
parent4c7f3f68187a31d355666cd3757e7715f75c18f3 (diff)
downloademacs-70d7ae36dd2b57b5023dca4cfc48a3d5533ab82c.tar.gz
(stat): Only root directory passed to GetDriveType. Allow RAM disk as well
as local fixed disk when w32-get-true-file-attributes is set to `local'.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9282748191a..4a16ff32b11 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-30 Eli Zaretskii <eliz@gnu.org>
+
+ * w32.c (stat): Only root directory passed to GetDriveType. Allow
+ RAM disk as well as local fixed disk when
+ w32-get-true-file-attributes is set to `local'.
+
2008-08-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* macterm.c [USE_CG_DRAWING] (mac_draw_cg_image):
diff --git a/src/w32.c b/src/w32.c
index aa6c21e4402..3c2fae73a4b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2390,6 +2390,8 @@ int
stat (const char * path, struct stat * buf)
{
char *name, *r;
+ char drive_root[4];
+ UINT devtype;
WIN32_FIND_DATA wfd;
HANDLE fh;
DWORD fake_inode;
@@ -2491,9 +2493,19 @@ stat (const char * path, struct stat * buf)
}
}
+ /* GetDriveType needs the root directory of NAME's drive. */
+ if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1])))
+ devtype = GetDriveType (NULL); /* use root of current diectory */
+ else
+ {
+ strncpy (drive_root, name, 3);
+ drive_root[3] = '\0';
+ devtype = GetDriveType (drive_root);
+ }
+
if (!(NILP (Vw32_get_true_file_attributes)
|| (EQ (Vw32_get_true_file_attributes, Qlocal) &&
- GetDriveType (name) != DRIVE_FIXED))
+ devtype != DRIVE_FIXED && devtype != DRIVE_RAMDISK))
/* No access rights required to get info. */
&& (fh = CreateFile (name, 0, 0, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL))