Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Feb 2010 14:19:56 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204276 - head/bin/sh
Message-ID:  <201002241419.o1OEJug1010875@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Wed Feb 24 14:19:56 2010
New Revision: 204276
URL: http://svn.freebsd.org/changeset/base/204276

Log:
  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

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Wed Feb 24 13:13:29 2010	(r204275)
+++ head/bin/sh/parser.c	Wed Feb 24 14:19:56 2010	(r204276)
@@ -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++)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002241419.o1OEJug1010875>