From: Richard M. Stallman Date: Sat, 16 May 1998 19:56:07 +0000 (+0000) Subject: (Fexpand_file_name) [WINDOWSNT]: Be careful not to X-Git-Tag: emacs-20.3~971 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f5321b5c8a5fe2e79344f79f790283ae3a13c2a8;p=emacs.git (Fexpand_file_name) [WINDOWSNT]: Be careful not to concatenate the directory prefix and file name to accidentally create a network share name. --- 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'.") { #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);