Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 2010 15:55:18 +0000 (UTC)
From:      Ulrich Spoerlein <uqs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r209049 - stable/8/bin/pax
Message-ID:  <201006111555.o5BFtI2W020558@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: uqs
Date: Fri Jun 11 15:55:18 2010
New Revision: 209049
URL: http://svn.freebsd.org/changeset/base/209049

Log:
  iMFC r208484: Fix back references in substitute command for pax(1)
  
  pax(1) was trying to copy the back-referenced data from
  the match pattern, not the matched data.
  
  Approved by:	re (kib)

Modified:
  stable/8/bin/pax/pat_rep.c
Directory Properties:
  stable/8/bin/pax/   (props changed)

Modified: stable/8/bin/pax/pat_rep.c
==============================================================================
--- stable/8/bin/pax/pat_rep.c	Fri Jun 11 15:49:39 2010	(r209048)
+++ stable/8/bin/pax/pat_rep.c	Fri Jun 11 15:55:18 2010	(r209049)
@@ -76,7 +76,7 @@ static char * range_match(char *, int);
 #ifdef NET2_REGEX
 static int resub(regexp *, char *, char *, char *);
 #else
-static int resub(regex_t *, regmatch_t *, char *, char *, char *);
+static int resub(regex_t *, regmatch_t *, char *, char *, char *, char *);
 #endif
 
 /*
@@ -929,7 +929,7 @@ rep_name(char *name, int *nlen, int prnt
 #			ifdef NET2_REGEX
 			if ((res = resub(pt->rcmp,pt->nstr,outpt,endpt)) < 0) {
 #			else
-			if ((res = resub(&(pt->rcmp),pm,pt->nstr,outpt,endpt))
+			if ((res = resub(&(pt->rcmp),pm,inpt,pt->nstr,outpt,endpt))
 			    < 0) {
 #			endif
 				if (prnt)
@@ -1071,7 +1071,7 @@ resub(regexp *prog, char *src, char *des
  */
 
 static int
-resub(regex_t *rp, regmatch_t *pm, char *src, char *dest,
+resub(regex_t *rp, regmatch_t *pm, char *orig, char *src, char *dest,
 	char *destend)
 {
 	char *spt;
@@ -1121,7 +1121,7 @@ resub(regex_t *rp, regmatch_t *pm, char 
 		 */
 		if (len > (destend - dpt))
 			len = destend - dpt;
-		if (l_strncpy(dpt, src + pmpt->rm_so, len) != len)
+		if (l_strncpy(dpt, orig + pmpt->rm_so, len) != len)
 			return(-1);
 		dpt += len;
 	}



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