[syslog-ng] [PATCH] cfg-lexer: Allow @include "dir/*.conf" to match none.

Gergely Nagy algernon at balabit.hu
Fri Mar 30 12:03:46 CEST 2012


@include "dir/" does not treat an empty directory as an error, nor
should @include "*pattern*" error out if it found no matches.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 lib/cfg-lexer.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/cfg-lexer.c b/lib/cfg-lexer.c
index 9469cbf..5badde1 100644
--- a/lib/cfg-lexer.c
+++ b/lib/cfg-lexer.c
@@ -485,8 +485,13 @@ cfg_lexer_include_file_glob_at(CfgLexer *self, const gchar *pattern)
   glob_t globbuf;
   size_t i;
   gboolean status = FALSE;
+  int r;
 
-  if (glob(pattern, 0, NULL, &globbuf) != 0)
+  r = glob(pattern, 0, NULL, &globbuf);
+
+  if (r == GLOB_NOMATCH)
+    return TRUE;
+  if (r != 0)
     return FALSE;
 
   for (i = 0; i < globbuf.gl_pathc; i++)
-- 
1.7.9




More information about the syslog-ng mailing list