Mercurial > emacs
diff src/fileio.c @ 22106:f4a52ea42920
(Fexpand_file_name) [WINDOWSNT]: Be careful not to
concatenate the directory prefix and file name to accidentally
create a network share name.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sat, 16 May 1998 19:56:07 +0000 |
| parents | cc1d87834752 |
| children | be43fb8acb62 |
line wrap: on
line diff
--- a/src/fileio.c Sat May 16 19:08:49 1998 +0000 +++ b/src/fileio.c Sat May 16 19:56:07 1998 +0000 @@ -1419,7 +1419,18 @@ { #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);
