aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2019-12-13 17:52:09 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-12-13 17:52:09 +0000
commitde579766917e560eb880a7a13688d931116c97aa (patch)
tree7ad38d7fe3ad92887df9509460b63cc08e7ede25
parentc3eda7cbf163c8399e011ad79eb36f08ee68f7a6 (diff)
downloadsrc-de579766917e560eb880a7a13688d931116c97aa.tar.gz
src-de579766917e560eb880a7a13688d931116c97aa.zip
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.
Notes
Notes: svn path=/head/; revision=355718
-rw-r--r--sbin/devd/devd.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index afd57d452f06..a1b6ee479921 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -681,15 +681,15 @@ config::expand_one(const char *&src, string &dst, bool is_shell)
// 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;
}