changeset 1358:aa32c275cbf9

(directory_file_name): Don't clobber the envvar when handling top-level rooted dir.
author Richard M. Stallman <rms@gnu.org>
date Tue, 06 Oct 1992 22:02:49 +0000
parents d1bd58483c59
children 96c43cee31f1
files src/fileio.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Tue Oct 06 21:06:25 1992 +0000
+++ b/src/fileio.c	Tue Oct 06 22:02:49 1992 +0000
@@ -468,9 +468,11 @@
 		  && (ptr[rlen] == ']' || ptr[rlen] == '>')
 		  && ptr[rlen - 1] == '.')
 		{
-		  ptr[rlen - 1] = ']';
-		  ptr[rlen] = '\0';
-		  return directory_file_name (ptr, dst);
+		  char * buf = (char *) alloca (strlen (ptr) + 1);
+		  strcpy (buf, ptr);
+		  buf[rlen - 1] = ']';
+		  buf[rlen] = '\0';
+		  return directory_file_name (buf, dst);
 		}
 	      else
 		dst[slen - 1] = ':';