Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2010 16:06:43 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r204637 - stable/8/bin/sh
Message-ID:  <201003031606.o23G6hHs097760@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Wed Mar  3 16:06:43 2010
New Revision: 204637
URL: http://svn.freebsd.org/changeset/base/204637

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

Modified:
  stable/8/bin/sh/parser.c
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/parser.c
==============================================================================
--- stable/8/bin/sh/parser.c	Wed Mar  3 15:43:26 2010	(r204636)
+++ stable/8/bin/sh/parser.c	Wed Mar  3 16:06:43 2010	(r204637)
@@ -1631,7 +1631,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?201003031606.o23G6hHs097760>