diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-04-18 02:26:05 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-04-18 02:26:05 +0000 |
commit | 8ee085a488bc50e3d2c77b6b674de7992edee39b (patch) | |
tree | e96688b6a429dcc22c0bbd540c6ed7a2d408d9c1 /src | |
parent | ce20300145fc056032105014adaa887379b00395 (diff) | |
download | emacs-8ee085a488bc50e3d2c77b6b674de7992edee39b.tar.gz |
(Fexpand_file_name): Refine last fix so `nm' is only
relocated if it points to `name'.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/fileio.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 527ff3c689d..0b849d99c43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-04-18 Stefan Monnier <monnier@iro.umontreal.ca> + + * fileio.c (Fexpand_file_name): Refine last fix so `nm' is only + relocated if it points to `name'. + 2008-04-17 Kenichi Handa <handa@m17n.org> * data.c (Faset): Allow setting a multibyte character in an diff --git a/src/fileio.c b/src/fileio.c index 498d2bb192b..6c8db062be8 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1045,6 +1045,7 @@ See also the function `substitute-in-file-name'. */) /* 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 @@ See also the function `substitute-in-file-name'. */) } 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 @@ See also the function `substitute-in-file-name'. */) 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 @@ See also the function `substitute-in-file-name'. */) int offset = nm - SDATA (name); hdir = DECODE_FILE (tem); newdir = SDATA (hdir); + if (nm_in_name) nm = SDATA (name) + offset; } #ifdef DOS_NT |