BUG/MINOR: log: fix regression introduced by commit 8a3f52
The commit above improved error reporting during log parsing, but as a result, some shared strings such as httplog_format are truncated during parsing. This is observable upon startup because the second proxy to use httplog emits a warning. Let's have the logformat parser duplicate the string while parsing it.
This commit is contained in:
parent
b5ba4ec1f0
commit
3ed22a4390
|
@ -359,9 +359,9 @@ void add_sample_to_logformat_list(char *text, char *arg, int arg_len, struct pro
|
||||||
* list_format: the destination list
|
* list_format: the destination list
|
||||||
* capabilities: PR_MODE_TCP_ | PR_MODE_HTTP
|
* capabilities: PR_MODE_TCP_ | PR_MODE_HTTP
|
||||||
*/
|
*/
|
||||||
void parse_logformat_string(char *str, struct proxy *curproxy, struct list *list_format, int capabilities)
|
void parse_logformat_string(char *fmt, struct proxy *curproxy, struct list *list_format, int capabilities)
|
||||||
{
|
{
|
||||||
char *sp = str; /* start pointer for text parts */
|
char *sp, *str; /* start pointer for text parts */
|
||||||
char *arg = NULL; /* start pointer for args */
|
char *arg = NULL; /* start pointer for args */
|
||||||
char *var = NULL; /* start pointer for vars */
|
char *var = NULL; /* start pointer for vars */
|
||||||
int arg_len = 0;
|
int arg_len = 0;
|
||||||
|
@ -371,6 +371,7 @@ void parse_logformat_string(char *str, struct proxy *curproxy, struct list *list
|
||||||
struct logformat_node *tmplf, *back;
|
struct logformat_node *tmplf, *back;
|
||||||
int options = 0;
|
int options = 0;
|
||||||
|
|
||||||
|
sp = str = fmt = strdup(fmt);
|
||||||
curproxy->to_log |= LW_INIT;
|
curproxy->to_log |= LW_INIT;
|
||||||
|
|
||||||
/* flush the list first. */
|
/* flush the list first. */
|
||||||
|
@ -481,6 +482,8 @@ void parse_logformat_string(char *str, struct proxy *curproxy, struct list *list
|
||||||
|
|
||||||
if (pformat == LF_STARTVAR || pformat == LF_STARG || pformat == LF_STEXPR)
|
if (pformat == LF_STARTVAR || pformat == LF_STARG || pformat == LF_STEXPR)
|
||||||
Warning("Ignoring end of truncated log-format line after '%s'\n", var ? var : arg ? arg : "%");
|
Warning("Ignoring end of truncated log-format line after '%s'\n", var ? var : arg ? arg : "%");
|
||||||
|
|
||||||
|
free(fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue