Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2019 18:53:07 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r356133 - stable/11/sbin/devd
Message-ID:  <201912271853.xBRIr7kD082905@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Dec 27 18:53:07 2019
New Revision: 356133
URL: https://svnweb.freebsd.org/changeset/base/356133

Log:
  MFC r355718: Fix $() handling, broken since the beginning at r108014.
  
  Due to off-by-one error in brackets counting it consumed the rest of the
  string, preventing later variables expansions.

Modified:
  stable/11/sbin/devd/devd.cc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/devd/devd.cc
==============================================================================
--- stable/11/sbin/devd/devd.cc	Fri Dec 27 18:52:43 2019	(r356132)
+++ stable/11/sbin/devd/devd.cc	Fri Dec 27 18:53:07 2019	(r356133)
@@ -637,15 +637,15 @@ config::expand_one(const char *&src, string &dst)
 	// it through.
 	if (*src == '(') {
 		dst += '$';
-		count = 1;
+		count = 0;
 		/* If the string ends before ) is matched , return. */
-		while (count > 0 && *src) {
+		do {
 			if (*src == ')')
 				count--;
 			else if (*src == '(')
 				count++;
 			dst += *src++;
-		}
+		} while (count > 0 && *src);
 		return;
 	}
 



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