summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-02-24 14:19:56 +0000
committerjh <jh@FreeBSD.org>2010-02-24 14:19:56 +0000
commitb557f570b2b71d4ecf8371b3c9a574c75e6938d8 (patch)
treeee2f405ab16a4714771a7954681a384e6eb69c2c /bin
parentcf30462ca93d9f073a75ed3ec00bf4d4ac0f1146 (diff)
downloadFreeBSD-src-b557f570b2b71d4ecf8371b3c9a574c75e6938d8.zip
FreeBSD-src-b557f570b2b71d4ecf8371b3c9a574c75e6938d8.tar.gz
Fix expansion of \W in prompt strings when the working directory is "/".
The prompt string was truncated after \W when the working directory was "/". PR: bin/89410 Submitted by: Dr Balwinder Singh Dheeman MFC after: 1 week
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index f8fd0ed..d8903c9 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1641,7 +1641,7 @@ getprompt(void *unused __unused)
case 'w':
ps[i] = '\0';
getcwd(&ps[i], PROMPTLEN - i);
- if (*fmt == 'W') {
+ if (*fmt == 'W' && ps[i + 1] != '\0') {
/* Final path component only. */
trim = 1;
for (j = i; ps[j] != '\0'; j++)
OpenPOWER on IntegriCloud