svn commit: r355718 - head/sbin/devd
Alexander Motin
mav at FreeBSD.org
Fri Dec 13 17:52:10 UTC 2019
Author: mav
Date: Fri Dec 13 17:52:09 2019
New Revision: 355718
URL: https://svnweb.freebsd.org/changeset/base/355718
Log:
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.
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Modified:
head/sbin/devd/devd.cc
Modified: head/sbin/devd/devd.cc
==============================================================================
--- head/sbin/devd/devd.cc Fri Dec 13 16:51:56 2019 (r355717)
+++ head/sbin/devd/devd.cc Fri Dec 13 17:52:09 2019 (r355718)
@@ -681,15 +681,15 @@ config::expand_one(const char *&src, string &dst, bool
// This is the escape hatch for passing down shell subcommands
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