Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Jul 2016 05:31:09 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303572 - head/usr.bin/sed
Message-ID:  <201607310531.u6V5V9U0093025@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Jul 31 05:31:09 2016
New Revision: 303572
URL: https://svnweb.freebsd.org/changeset/base/303572

Log:
  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

Modified:
  head/usr.bin/sed/main.c

Modified: head/usr.bin/sed/main.c
==============================================================================
--- head/usr.bin/sed/main.c	Sun Jul 31 04:58:06 2016	(r303571)
+++ head/usr.bin/sed/main.c	Sun Jul 31 05:31:09 2016	(r303572)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607310531.u6V5V9U0093025>