# HG changeset patch # User Eli Zaretskii # Date 1220093646 0 # Node ID a20e957dc1724225bd493e9d1e3719ab04410e2e # Parent 5e49fbefd04738c5dc0c1d4704e07d05e1650143 (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'. diff -r 5e49fbefd047 -r a20e957dc172 src/w32.c --- a/src/w32.c Sat Aug 30 08:38:14 2008 +0000 +++ b/src/w32.c Sat Aug 30 10:54:06 2008 +0000 @@ -2390,6 +2390,8 @@ 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 @@ } } + /* 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))