diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-04-11 01:29:12 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-08 21:40:34 +0200 |
commit | e0cb9c65b837ad5d725761505049755db0112b1c (patch) | |
tree | 59b60addf885de2663f23601c93dfd47e0801fd9 /conf/cf-lex.l | |
parent | 04fbc0408da33ed6041bf92caaa82b25bcbf6601 (diff) |
Android: disable include patterns if glob is unsupported
Because of missing glob() in NDK platforms before 28
Diffstat (limited to 'conf/cf-lex.l')
-rw-r--r-- | conf/cf-lex.l | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 9ea05e9d..07392228 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -27,13 +27,16 @@ %{ #undef REJECT /* Avoid name clashes */ +#include "sysdep/config.h" #include <errno.h> #include <stdlib.h> #include <stdarg.h> #include <stdint.h> #include <unistd.h> #include <libgen.h> +#ifdef HAVE_GLOB #include <glob.h> +#endif #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> @@ -461,7 +464,9 @@ cf_include(char *arg, int alen) struct include_file_stack *base_ifs = ifs; int new_depth, rv, i; char *patt; +#ifdef HAVE_GLOB glob_t g = {}; +#endif new_depth = ifs->depth + 1; if (new_depth > MAX_INCLUDE_DEPTH) @@ -491,6 +496,7 @@ cf_include(char *arg, int alen) return; } +#ifdef HAVE_GLOB /* Expand the pattern */ rv = glob(patt, GLOB_ERR | GLOB_NOESCAPE, NULL, &g); if (rv == GLOB_ABORTED) @@ -526,6 +532,10 @@ cf_include(char *arg, int alen) globfree(&g); enter_ifs(ifs); +#else + cf_error("Pattern match unsupported %s: %m", patt); + return; +#endif /* !HAVE_GLOB */ } static int |