summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/ksh/ksh.113
-rw-r--r--bin/ksh/main.c11
2 files changed, 6 insertions, 18 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1
index 5e0713e3459..92be1c7399d 100644
--- a/bin/ksh/ksh.1
+++ b/bin/ksh/ksh.1
@@ -1,8 +1,8 @@
-.\" $OpenBSD: ksh.1,v 1.191 2017/07/06 15:42:04 schwarze Exp $
+.\" $OpenBSD: ksh.1,v 1.192 2017/08/11 23:10:55 guenther Exp $
.\"
.\" Public Domain
.\"
-.Dd $Mdocdate: July 6 2017 $
+.Dd $Mdocdate: August 11 2017 $
.Dt KSH 1
.Os
.Sh NAME
@@ -1535,15 +1535,6 @@ The default prompt is
for non-root users,
.Sq #\ \&
for root.
-If
-.Nm
-is invoked by root and
-.Ev PS1
-does not contain a
-.Sq #
-character, the default value will be used even if
-.Ev PS1
-already exists in the environment.
.Pp
The following backslash-escaped special characters can be used
to customise the prompt:
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 4e469188254..8ec59259991 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.82 2016/10/17 17:44:47 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.83 2017/08/11 23:10:55 guenther Exp $ */
/*
* startup, main loop, environments and error handling
@@ -313,14 +313,11 @@ main(int argc, char *argv[])
{
struct tbl *vp = global("PS1");
- /* Set PS1 if it isn't set, or we are root and prompt doesn't
- * contain a # or \$ (only in ksh mode).
- */
- if (!(vp->flag & ISSET) ||
- (!ksheuid && !strchr(str_val(vp), '#') &&
- (Flag(FSH) || !strstr(str_val(vp), "\\$"))))
+ /* Set PS1 if it isn't set */
+ if (!(vp->flag & ISSET)) {
/* setstr can't fail here */
setstr(vp, safe_prompt, KSH_RETURN_ERROR);
+ }
}
/* Set this before parsing arguments */