diff options
author | Richard M. Stallman <[email protected]> | 1998-05-16 19:56:07 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 1998-05-16 19:56:07 +0000 |
commit | f5321b5c8a5fe2e79344f79f790283ae3a13c2a8 (patch) | |
tree | e803bc3c7db830d1cb2638d5aaa2e45c0d3a1c8a /src/fileio.c | |
parent | 933bdce24d340a19304a2f2f7147b732d28380ed (diff) |
(Fexpand_file_name) [WINDOWSNT]: Be careful not to
concatenate the directory prefix and file name to accidentally
create a network share name.
Diffstat (limited to 'src/fileio.c')
-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 352129a085..aef7a01e0a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1419,7 +1419,18 @@ See also the function `substitute-in-file-name'.") { #ifndef VMS if (nm[0] == 0 || IS_DIRECTORY_SEP (nm[0])) - strcpy (target, newdir); + { +#ifdef WINDOWSNT + /* If newdir is effectively "C:/", then the drive letter will have + been stripped and newdir will be "/". Concatenating with an + absolute directory in nm produces "//", which will then be + incorrectly treated as a network share. Ignore newdir in + this case (keeping the drive letter). */ + if (!(drive && nm[0] && IS_DIRECTORY_SEP (newdir[0]) + && newdir[1] == '\0')) +#endif + strcpy (target, newdir); + } else #endif file_name_as_directory (target, newdir); |