summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/subst.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 937c026fb..65d10e5c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-18  Peter Stephenson  <pws@csr.com>
+
+	* 23114: Src/subst.c: ${foo:s/bar/rod} was broken (when final
+	delimiter is not present).
+
 2007-01-16  Peter Stephenson  <pws@csr.com>
 
 	* users/11113: Completion/Unix/Command/_todo.sh: extend
diff --git a/Src/subst.c b/Src/subst.c
index 2bc6d75a6..cee2e6e5c 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3477,7 +3477,11 @@ modify(char **str, char **ptr)
 			chuck(tt--);
 		*ptr1end = sav1;
 		*ptr3 = sav;
-		*ptr = ptr3 + charlen - 1;
+		*ptr = ptr3 - 1;
+		if (*ptr3) {
+		    /* Final terminator is optional. */
+		    *ptr += charlen;
+		}
 		break;
 
 	    case '&':