Author: mav Date: Fri Dec 27 18:52:43 2019 New Revision: 356132 URL: https://svnweb.freebsd.org/changeset/base/356132
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/12/sbin/devd/devd.cc Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/devd/devd.cc ============================================================================== --- stable/12/sbin/devd/devd.cc Fri Dec 27 17:55:56 2019 (r356131) +++ stable/12/sbin/devd/devd.cc Fri Dec 27 18:52:43 2019 (r356132) @@ -682,15 +682,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; } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"