Commit f5321b5c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Fexpand_file_name) [WINDOWSNT]: Be careful not to

concatenate the directory prefix and file name to accidentally
create a network share name.
parent 933bdce2
......@@ -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);
/* 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'))
strcpy (target, newdir);
file_name_as_directory (target, newdir);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment