summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--editors/sed.c2
-rw-r--r--testsuite/sed/sed-requires-newline-after-edit-command1
2 files changed, 2 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c
index fe1c0dbae..1c026d30b 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -322,7 +322,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
*
*/
- if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
+ if (editstr[1] != '\\' || (editstr[2] != '\n' && editstr[2] != '\r'))
error_msg_and_die("bad format in edit expression");
/* store the edit line text */
diff --git a/testsuite/sed/sed-requires-newline-after-edit-command b/testsuite/sed/sed-requires-newline-after-edit-command
new file mode 100644
index 000000000..37ebc6608
--- /dev/null
+++ b/testsuite/sed/sed-requires-newline-after-edit-command
@@ -0,0 +1 @@
+! busybox sed -e 'i\foo' </dev/null