# HG changeset patch # User Richard M. Stallman # Date 895348567 0 # Node ID f4a52ea42920e0a169cdca2c3a3260a28c2e0c95 # Parent 10196cc8877ca282e736d028b012f9796c662fcd (Fexpand_file_name) [WINDOWSNT]: Be careful not to concatenate the directory prefix and file name to accidentally create a network share name. diff -r 10196cc8877c -r f4a52ea42920 src/fileio.c --- 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);