svn commit: r356133 - stable/11/sbin/devd

Alexander Motin mav at FreeBSD.org
Fri Dec 27 18:53:08 UTC 2019


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;
 	}
 


More information about the svn-src-all mailing list