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

Pedro F. Giffuni pfg at FreeBSD.org
Tue May 10 02:02:51 UTC 2016


Author: pfg
Date: Tue May 10 02:02:50 2016
New Revision: 299294
URL: https://svnweb.freebsd.org/changeset/base/299294

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

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

Modified: head/usr.bin/sed/main.c
==============================================================================
--- head/usr.bin/sed/main.c	Tue May 10 00:51:50 2016	(r299293)
+++ head/usr.bin/sed/main.c	Tue May 10 02:02:50 2016	(r299294)
@@ -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;


More information about the svn-src-head mailing list