mirror of
https://github.com/MariaDB/server.git
synced 2025-05-10 02:01:19 +03:00
Fixed a bug with having comments after options in config files.
Bug ID: 235
This commit is contained in:
parent
b9f09fc588
commit
c9d76b51cf
@ -72,6 +72,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
|
|||||||
const char *dir, const char *config_file,
|
const char *dir, const char *config_file,
|
||||||
const char *ext, TYPELIB *group);
|
const char *ext, TYPELIB *group);
|
||||||
|
|
||||||
|
static char *remove_end_comment(char *ptr);
|
||||||
|
|
||||||
void load_defaults(const char *conf_file, const char **groups,
|
void load_defaults(const char *conf_file, const char **groups,
|
||||||
int *argc, char ***argv)
|
int *argc, char ***argv)
|
||||||
@ -297,9 +298,11 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
}
|
}
|
||||||
if (!read_values)
|
if (!read_values)
|
||||||
continue;
|
continue;
|
||||||
if (!(end=value=strchr(ptr,'=')))
|
end= remove_end_comment(ptr);
|
||||||
end=strend(ptr); /* Option without argument */
|
if ((value= strchr(ptr, '=')))
|
||||||
|
end= value; /* Option without argument */
|
||||||
for ( ; isspace(end[-1]) ; end--) ;
|
for ( ; isspace(end[-1]) ; end--) ;
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3)))
|
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3)))
|
||||||
@ -368,6 +371,29 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char *remove_end_comment(char *ptr)
|
||||||
|
{
|
||||||
|
char quote= 0;
|
||||||
|
|
||||||
|
for (; *ptr; ptr++)
|
||||||
|
{
|
||||||
|
if (*ptr == '\'' || *ptr == '\"')
|
||||||
|
{
|
||||||
|
if (!quote)
|
||||||
|
quote= *ptr;
|
||||||
|
else if (quote == *ptr)
|
||||||
|
quote= 0;
|
||||||
|
}
|
||||||
|
if (!quote && *ptr == '#') /* We are not inside a comment */
|
||||||
|
{
|
||||||
|
*ptr= 0;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_defaults(const char *conf_file, const char **groups)
|
void print_defaults(const char *conf_file, const char **groups)
|
||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user