diff options
| author | Richard M. Stallman | 1998-05-16 19:56:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-16 19:56:07 +0000 |
| commit | f5321b5c8a5fe2e79344f79f790283ae3a13c2a8 (patch) | |
| tree | e803bc3c7db830d1cb2638d5aaa2e45c0d3a1c8a | |
| parent | 933bdce24d340a19304a2f2f7147b732d28380ed (diff) | |
| download | emacs-f5321b5c8a5fe2e79344f79f790283ae3a13c2a8.tar.gz emacs-f5321b5c8a5fe2e79344f79f790283ae3a13c2a8.zip | |
(Fexpand_file_name) [WINDOWSNT]: Be careful not to
concatenate the directory prefix and file name to accidentally
create a network share name.
| -rw-r--r-- | src/fileio.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 352129a0853..aef7a01e0a3 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1419,7 +1419,18 @@ See also the function `substitute-in-file-name'.") | |||
| 1419 | { | 1419 | { |
| 1420 | #ifndef VMS | 1420 | #ifndef VMS |
| 1421 | if (nm[0] == 0 || IS_DIRECTORY_SEP (nm[0])) | 1421 | if (nm[0] == 0 || IS_DIRECTORY_SEP (nm[0])) |
| 1422 | strcpy (target, newdir); | 1422 | { |
| 1423 | #ifdef WINDOWSNT | ||
| 1424 | /* If newdir is effectively "C:/", then the drive letter will have | ||
| 1425 | been stripped and newdir will be "/". Concatenating with an | ||
| 1426 | absolute directory in nm produces "//", which will then be | ||
| 1427 | incorrectly treated as a network share. Ignore newdir in | ||
| 1428 | this case (keeping the drive letter). */ | ||
| 1429 | if (!(drive && nm[0] && IS_DIRECTORY_SEP (newdir[0]) | ||
| 1430 | && newdir[1] == '\0')) | ||
| 1431 | #endif | ||
| 1432 | strcpy (target, newdir); | ||
| 1433 | } | ||
| 1423 | else | 1434 | else |
| 1424 | #endif | 1435 | #endif |
| 1425 | file_name_as_directory (target, newdir); | 1436 | file_name_as_directory (target, newdir); |