# HG changeset patch # User Stefan Monnier # Date 1208485565 0 # Node ID b9c54321b685990b7fcd02c93979cd11de273323 # Parent 14cbf4c7b904b9349f3055a473cd85fe1b6af8d8 (Fexpand_file_name): Refine last fix so `nm' is only relocated if it points to `name'. diff -r 14cbf4c7b904 -r b9c54321b685 src/ChangeLog --- a/src/ChangeLog Fri Apr 18 02:01:46 2008 +0000 +++ b/src/ChangeLog Fri Apr 18 02:26:05 2008 +0000 @@ -1,3 +1,8 @@ +2008-04-18 Stefan Monnier + + * fileio.c (Fexpand_file_name): Refine last fix so `nm' is only + relocated if it points to `name'. + 2008-04-17 Kenichi Handa * data.c (Faset): Allow setting a multibyte character in an diff -r 14cbf4c7b904 -r b9c54321b685 src/fileio.c --- a/src/fileio.c Fri Apr 18 02:01:46 2008 +0000 +++ b/src/fileio.c Fri Apr 18 02:26:05 2008 +0000 @@ -1045,6 +1045,7 @@ /* These point to SDATA and need to be careful with string-relocation during GC (via DECODE_FILE). */ unsigned char *nm, *newdir; + int nm_in_name; /* This should only point to alloca'd data. */ unsigned char *target; @@ -1158,11 +1159,13 @@ } nm = SDATA (name); + nm_in_name = 1; #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); + nm_in_name = 0; /* Note if special escape prefix is present, but remove for now. */ if (nm[0] == '/' && nm[1] == ':') @@ -1321,6 +1324,7 @@ if (index (nm, '/')) { nm = sys_translate_unix (nm); + nm_in_name = 0; return make_specified_string (nm, -1, strlen (nm), multibyte); } #endif /* VMS */ @@ -1396,6 +1400,7 @@ int offset = nm - SDATA (name); hdir = DECODE_FILE (tem); newdir = SDATA (hdir); + if (nm_in_name) nm = SDATA (name) + offset; } #ifdef DOS_NT