diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-02-28 10:02:27 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-02-28 10:02:27 +0100 |
commit | b129a96287492685050f6f80f8f0204122b22e77 (patch) | |
tree | ca61a93209211cca53355926bac15603ae10f7fc /grammar/rainerscript.c | |
parent | 1deef18daa1b39035e42c8b1db68286727d8f950 (diff) | |
download | rsyslog-b129a96287492685050f6f80f8f0204122b22e77.tar.gz rsyslog-b129a96287492685050f6f80f8f0204122b22e77.tar.bz2 rsyslog-b129a96287492685050f6f80f8f0204122b22e77.zip |
bugfix: include files got included in the wrong order
This happens if an $IncludeConfig directive was done on multiple
files (e.g. the distro default of $IncludeConfig /etc/rsyslog.d/*.conf).
In that case, the order of include file processing is reversed, which
could lead to all sorts of problems.
Thanks to Nathan Stratton Treadway for his great analysis of the problem,
which made bug fixing really easy.
Diffstat (limited to 'grammar/rainerscript.c')
-rw-r--r-- | grammar/rainerscript.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 0584d6a9..20b86c5c 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -2793,7 +2793,7 @@ cnfDoInclude(char *name) { char *cfgFile; char *finalName; - unsigned i; + int i; int result; glob_t cfgFiles; struct stat fileInfo; @@ -2829,7 +2829,12 @@ cnfDoInclude(char *name) return 1; } - for(i = 0; i < cfgFiles.gl_pathc; i++) { + /* note: bison "stacks" the files, so we need to submit them + * in reverse order to the *stack* in order to get the proper + * parsing order. Also see + * http://bugzilla.adiscon.com/show_bug.cgi?id=411 + */ + for(i = cfgFiles.gl_pathc - 1; i >= 0 ; i--) { cfgFile = cfgFiles.gl_pathv[i]; if(stat(cfgFile, &fileInfo) != 0) { char errStr[1024]; |