Don't use global variable as local in recursion context

```nginx
include conf.d/*;
include sites-enabled/*;
```
In this situation, after the first recursive `_checkConf` invocation 4 lines below, `$_c_file` does not contain what you expect anymore, and the second lookup checks for `conf.d/sites-enabled/*` which is obviously wrong.
This commit is contained in:
Phil Krylov 2021-10-08 18:24:21 +02:00 committed by GitHub
parent 8fcecd59a0
commit 40e8c5e2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3168,7 +3168,7 @@ _checkConf() {
for included in $(cat "$2" | tr "\t" " " | grep "^ *include *.*;" | sed "s/include //" | tr -d " ;"); do for included in $(cat "$2" | tr "\t" " " | grep "^ *include *.*;" | sed "s/include //" | tr -d " ;"); do
_debug "check included $included" _debug "check included $included"
if ! _startswith "$included" "/" && _exists dirname; then if ! _startswith "$included" "/" && _exists dirname; then
_relpath="$(dirname "$_c_file")" _relpath="$(dirname "$2")"
_debug "_relpath" "$_relpath" _debug "_relpath" "$_relpath"
included="$_relpath/$included" included="$_relpath/$included"
fi fi