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

Reply via email to