mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
fixed config parser to recognize correctly strings like following:
test="\"#no comment here"#real comment
This commit is contained in:
@ -449,11 +449,12 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
|
|
||||||
static char *remove_end_comment(char *ptr)
|
static char *remove_end_comment(char *ptr)
|
||||||
{
|
{
|
||||||
char quote= 0;
|
char quote= 0; /* we are inside quote marks */
|
||||||
|
char escape= 0; /* symbol is protected by escape chagacter */
|
||||||
|
|
||||||
for (; *ptr; ptr++)
|
for (; *ptr; ptr++)
|
||||||
{
|
{
|
||||||
if (*ptr == '\'' || *ptr == '\"')
|
if ((*ptr == '\'' || *ptr == '\"') && !escape)
|
||||||
{
|
{
|
||||||
if (!quote)
|
if (!quote)
|
||||||
quote= *ptr;
|
quote= *ptr;
|
||||||
@ -465,6 +466,7 @@ static char *remove_end_comment(char *ptr)
|
|||||||
*ptr= 0;
|
*ptr= 0;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
escape= (quote && *ptr == '\\' && !escape);
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user