summary refs log tree commit diff
path: root/bin/1sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/1sh')
-rw-r--r--bin/1sh/parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c
index 39b36e67..a7b86aab 100644
--- a/bin/1sh/parser.c
+++ b/bin/1sh/parser.c
@@ -2042,10 +2042,12 @@ expandprompt(const char *fmt) {
 				 * Exit status if non-zero.
 				 */
 			case '?':
-				if (exitstatus != 0)
+				if (exitstatus != 0) {
 					snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus);
-				else
-					i--;
+					while (ps[i] != '\0')
+						i++;
+				}
+				i--;
 				break;
 
 				/*
18c6874&follow=1'>Update litterbox to 1.6June McEnroe 2020-08-23Add scooper portJune McEnroe 2020-08-23Add catsit portJune McEnroe 2020-08-13Update pounce to 1.4p2June McEnroe 2020-08-11Update pounce to 1.4p1June McEnroe 2020-08-10Add litterbox portJune McEnroe 2020-08-10Add missing USES=pkgconfig to pounceJune McEnroe