diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2025-10-23 12:00:21 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2025-11-08 07:42:34 +0100 |
| commit | 8cafd7a908347a584261ee630fab2ba183273a86 (patch) | |
| tree | 82d8e6fac75b29a77650e752f609b080301643fc | |
| parent | 782e3fc2b4012958d43e964064fd2f2806d46106 (diff) | |
lineedit: fix PS1='\W' for root directory
'\W' in PS1 returned an empty string for the root directory. bash
displays '/' in similar circumstances.
Avoid returning an empty string for the directory.
function old new delta
parse_and_put_prompt 873 883 +10
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | libbb/lineedit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 10cc0433b..1ca21e924 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2079,7 +2079,7 @@ static void parse_and_put_prompt(const char *prmt_ptr) if (c == 'w') break; cp = strrchr(pbuf, '/'); - if (cp) + if (cp && cp[1]) pbuf = (char*)cp + 1; break; // bb_process_escape_sequence does this now: |
