diff options
author | Alexander Motin <mav@FreeBSD.org> | 2019-12-13 17:52:09 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2019-12-13 17:52:09 +0000 |
commit | de579766917e560eb880a7a13688d931116c97aa (patch) | |
tree | 7ad38d7fe3ad92887df9509460b63cc08e7ede25 /sbin/devd | |
parent | c3eda7cbf163c8399e011ad79eb36f08ee68f7a6 (diff) | |
download | src-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
Diffstat (limited to 'sbin/devd')
-rw-r--r-- | sbin/devd/devd.cc | 6 |
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; } |