From 637a1a744639d75fc88439cfeb59d973cfe73fa1 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sun, 31 Jul 2016 05:31:09 +0000 Subject: [PATCH] Fix regression with /i caused by r303047 '\n' was specifically added to -e arguments prior to r303047. Restore historical behavior which in turn fixes usr.sbin/etcupdate/preworld_test:main . The fix is being committed to address the issue in the short term and may be iterated upon as noted in bug 211399 Discussed with: mi, pfg Differential Revision: https://reviews.freebsd.org/D7368 PR: 195929, 211399 [*] MFC after: 18 days X-MFC with: r303047 Reported by: Jenkins Sponsored by: EMC / Isilon Storage Division --- usr.bin/sed/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index fb3eca89d800..39d720cbb483 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -123,6 +123,7 @@ static void usage(void); int main(int argc, char *argv[]) { + char *temp_arg; int c, fflag; (void) setlocale(LC_ALL, ""); @@ -145,7 +146,10 @@ main(int argc, char *argv[]) break; case 'e': eflag = 1; - add_compunit(CU_STRING, optarg); + asprintf(&temp_arg, "%s\n", optarg); + if (temp_arg == NULL) + errx(1, "Couldn't allocate temporary buffer"); + add_compunit(CU_STRING, temp_arg); break; case 'f': fflag = 1;