changeset 80773:c37da6340b74

(Fexpand_file_name): Copy argument `name' into local storage on all platforms, not just on DOS_NT.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 29 Aug 2008 10:07:15 +0000
parents 8d9c25087de7
children 99fcb7a012f0
files src/fileio.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Fri Aug 29 08:18:41 2008 +0000
+++ b/src/fileio.c	Fri Aug 29 10:07:15 2008 +0000
@@ -1149,11 +1149,10 @@
   nm = SDATA (name);
   multibyte = STRING_MULTIBYTE (name);
 
+  /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
+  nm = strcpy (alloca (strlen (nm) + 1), nm);
+
 #ifdef DOS_NT
-  /* We will force directory separators to be either all \ or /, so make
-     a local copy to modify, even if there ends up being no change. */
-  nm = strcpy (alloca (strlen (nm) + 1), nm);
-
   /* Note if special escape prefix is present, but remove for now.  */
   if (nm[0] == '/' && nm[1] == ':')
     {
@@ -1340,7 +1339,7 @@
 	    }
 	  return name;
 #else /* not DOS_NT */
-	  if (nm == SDATA (name))
+	  if (strcmp (nm, SDATA (name)) == 0)
 	    return name;
 	  return make_specified_string (nm, -1, strlen (nm), multibyte);
 #endif /* not DOS_NT */