From bc81b4d9e87d2cbf51868288a07d453a03cd0e96 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Thu, 24 Jun 2021 22:55:33 +0100 Subject: [PATCH] put an end to LINE_MAX issues for some reason, getting this macro is really hard across platforms, requiring either different feature test macros or even the right order of included headers, and its usage caused several build failures in the past. fix it once and for all by just using 1024 as max line length if the macro can't be retrieved. closes #382 --- src/conf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index 1a78816..4e6d19e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -40,6 +40,12 @@ #include "basicauth.h" #include "conf-tokens.h" +#ifdef LINE_MAX +#define TP_LINE_MAX LINE_MAX +#else +#define TP_LINE_MAX 1024 +#endif + /* * The configuration directives are defined in the structure below. Each * directive requires a regular expression to match against, and a @@ -409,7 +415,7 @@ static int check_match (struct config_s *conf, const char *line, */ static int config_parse (struct config_s *conf, FILE * f) { - char buffer[LINE_MAX], *p, *q, c; + char buffer[TP_LINE_MAX], *p, *q, c; const struct config_directive_entry *e; unsigned long lineno = 1;