svn commit: r303572 - head/usr.bin/sed

Garrett Cooper ngie at FreeBSD.org
Sun Jul 31 05:31:10 UTC 2016


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;


More information about the svn-src-head mailing list