summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c5
1 files changed, 1 insertions, 4 deletions
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;