From 11398c77da5e1a237e3625be1b11022ba730aa64 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Tue, 10 May 2016 02:02:50 +0000 Subject: [PATCH] Revert r299279: Simplify redundant malloc'ing in sed -e. It is causing havoc in the ports tree: ===> Configuring for wxsvg-1.5.7 sed: 1: "/gcc_dir=\\`/s/gcc /$CC /": bad flag in substitute command: '/' *** Error code 1 ===> Patching for vips-8.3.1 sed: 1: "1s|^#![[:space:]]*/usr/ ...": bad flag in substitute command: 's' *** Error code 1 PR: 195929 Reported by: danilo --- usr.bin/sed/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index a5ff4627ccb9..36a32996a130 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -125,6 +125,7 @@ int main(int argc, char *argv[]) { int c, fflag; + char *temp_arg; (void) setlocale(LC_ALL, ""); @@ -146,7 +147,11 @@ main(int argc, char *argv[]) break; case 'e': eflag = 1; - add_compunit(CU_STRING, optarg); + if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL) + err(1, "malloc"); + strcpy(temp_arg, optarg); + strcat(temp_arg, "\n"); + add_compunit(CU_STRING, temp_arg); break; case 'f': fflag = 1;