about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-03-29 12:06:23 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-03-29 12:06:23 +0000
commit44ff671fe5584a9fb073c4b767825c58504aa083 (patch)
tree2c04b0778f9f3673b84f94d13447c11019fd0d6a
parent3278ad8490ce04f5178e8873661a369f34d04531 (diff)
downloadzsh-44ff671fe5584a9fb073c4b767825c58504aa083.tar.gz
zsh-44ff671fe5584a9fb073c4b767825c58504aa083.tar.xz
zsh-44ff671fe5584a9fb073c4b767825c58504aa083.zip
Don't assume we can change the string for the HOST parameter when used in
a prompt
-rw-r--r--ChangeLog5
-rw-r--r--Src/prompt.c5
2 files changed, 5 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 85edc7ccd..b5ad41ded 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2001-03-29  Peter Stephenson  <pws@csr.com>
 
-	* 13837: Src/builtin.c: disallows changing of parameter type
+	* 13838: Src/prompt.c: don't assume we can change the string
+	returned by getsparam("HOST").
+
+	* 13837: Src/builtin.c: disallow changing of parameter type
 	for autoloadable parameter (bug 219459 on Sourceforge).
 
 2001-03-29  Sven Wischnowsky  <wischnow@zsh.org>
diff --git a/Src/prompt.c b/Src/prompt.c
index b90bfff2a..84f88b2d3 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -392,10 +392,7 @@ putpromptchar(int doprint, int endchar)
 		    for (ss = hostnam; *ss; ss++)
 			if (*ss == '.' && !--arg)
 			    break;
-		    t0 = *ss;
-		    *ss = '\0';
-		    stradd(hostnam);
-		    *ss = t0;
+		    stradd(*ss ? dupstrpfx(hostnam, ss - hostnam) : hostnam);
 		}
 		unqueue_signals();
 		break;