From e39afe1fbd6d9f1ad1eea0052a5163572e11a98f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 24 Apr 2012 19:21:16 +0200 Subject: sed: fix handling of s/// which has empty matches Signed-off-by: Denys Vlasenko --- editors/sed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/sed.c') diff --git a/editors/sed.c b/editors/sed.c index 4e9babb9d..429c1ed58 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -741,7 +741,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p) * The match_count check is so not to break * echo "hi" | busybox sed 's/^/!/g' */ - if (!G.regmatch[0].rm_so && !G.regmatch[0].rm_eo && match_count) { + if (!G.regmatch[0].rm_so && !G.regmatch[0].rm_eo && match_count && *line) { pipe_putc(*line++); continue; } -- cgit v1.2.3