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++)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to