diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 54 |
1 files changed, 37 insertions, 17 deletions
| @@ -2555,12 +2555,23 @@ logon_network_drive (const char *path) | |||
| 2555 | char share[MAX_PATH]; | 2555 | char share[MAX_PATH]; |
| 2556 | int i, n_slashes; | 2556 | int i, n_slashes; |
| 2557 | char drive[4]; | 2557 | char drive[4]; |
| 2558 | UINT drvtype; | ||
| 2558 | 2559 | ||
| 2559 | sprintf (drive, "%c:\\", path[0]); | 2560 | if (IS_DIRECTORY_SEP (path[0]) && IS_DIRECTORY_SEP (path[1])) |
| 2561 | drvtype = DRIVE_REMOTE; | ||
| 2562 | else if (path[0] == '\0' || path[1] != ':') | ||
| 2563 | drvtype = GetDriveType (NULL); | ||
| 2564 | else | ||
| 2565 | { | ||
| 2566 | drive[0] = path[0]; | ||
| 2567 | drive[1] = ':'; | ||
| 2568 | drive[2] = '\\'; | ||
| 2569 | drive[3] = '\0'; | ||
| 2570 | drvtype = GetDriveType (drive); | ||
| 2571 | } | ||
| 2560 | 2572 | ||
| 2561 | /* Only logon to networked drives. */ | 2573 | /* Only logon to networked drives. */ |
| 2562 | if ((!IS_DIRECTORY_SEP (path[0]) || !IS_DIRECTORY_SEP (path[1])) | 2574 | if (drvtype != DRIVE_REMOTE) |
| 2563 | && GetDriveType (drive) != DRIVE_REMOTE) | ||
| 2564 | return; | 2575 | return; |
| 2565 | 2576 | ||
| 2566 | n_slashes = 2; | 2577 | n_slashes = 2; |
| @@ -3234,6 +3245,28 @@ get_file_owner_and_group ( | |||
| 3234 | } | 3245 | } |
| 3235 | } | 3246 | } |
| 3236 | 3247 | ||
| 3248 | /* Return non-zero if NAME is a potentially slow filesystem. */ | ||
| 3249 | int | ||
| 3250 | is_slow_fs (const char *name) | ||
| 3251 | { | ||
| 3252 | char drive_root[4]; | ||
| 3253 | UINT devtype; | ||
| 3254 | |||
| 3255 | if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1])) | ||
| 3256 | devtype = DRIVE_REMOTE; /* assume UNC name is remote */ | ||
| 3257 | else if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1]))) | ||
| 3258 | devtype = GetDriveType (NULL); /* use root of current drive */ | ||
| 3259 | else | ||
| 3260 | { | ||
| 3261 | /* GetDriveType needs the root directory of the drive. */ | ||
| 3262 | strncpy (drive_root, name, 2); | ||
| 3263 | drive_root[2] = '\\'; | ||
| 3264 | drive_root[3] = '\0'; | ||
| 3265 | devtype = GetDriveType (drive_root); | ||
| 3266 | } | ||
| 3267 | return !(devtype == DRIVE_FIXED || devtype == DRIVE_RAMDISK); | ||
| 3268 | } | ||
| 3269 | |||
| 3237 | /* MSVC stat function can't cope with UNC names and has other bugs, so | 3270 | /* MSVC stat function can't cope with UNC names and has other bugs, so |
| 3238 | replace it with our own. This also allows us to calculate consistent | 3271 | replace it with our own. This also allows us to calculate consistent |
| 3239 | inode values without hacks in the main Emacs code. */ | 3272 | inode values without hacks in the main Emacs code. */ |
| @@ -3347,21 +3380,8 @@ stat (const char * path, struct stat * buf) | |||
| 3347 | } | 3380 | } |
| 3348 | } | 3381 | } |
| 3349 | 3382 | ||
| 3350 | if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1])) | ||
| 3351 | devtype = DRIVE_REMOTE; /* assume UNC name is remote */ | ||
| 3352 | else if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1]))) | ||
| 3353 | devtype = GetDriveType (NULL); /* use root of current drive */ | ||
| 3354 | else | ||
| 3355 | { | ||
| 3356 | /* GetDriveType needs the root directory of NAME's drive. */ | ||
| 3357 | strncpy (drive_root, name, 3); | ||
| 3358 | drive_root[3] = '\0'; | ||
| 3359 | devtype = GetDriveType (drive_root); | ||
| 3360 | } | ||
| 3361 | |||
| 3362 | if (!(NILP (Vw32_get_true_file_attributes) | 3383 | if (!(NILP (Vw32_get_true_file_attributes) |
| 3363 | || (EQ (Vw32_get_true_file_attributes, Qlocal) | 3384 | || (EQ (Vw32_get_true_file_attributes, Qlocal) && !is_slow_fs (name))) |
| 3364 | && devtype != DRIVE_FIXED && devtype != DRIVE_RAMDISK)) | ||
| 3365 | /* No access rights required to get info. */ | 3385 | /* No access rights required to get info. */ |
| 3366 | && (fh = CreateFile (name, 0, 0, NULL, OPEN_EXISTING, | 3386 | && (fh = CreateFile (name, 0, 0, NULL, OPEN_EXISTING, |
| 3367 | FILE_FLAG_BACKUP_SEMANTICS, NULL)) | 3387 | FILE_FLAG_BACKUP_SEMANTICS, NULL)) |