summaryrefslogtreecommitdiff
path: root/mysys/default.c
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-03-20 23:50:04 +0200
committerunknown <bell@sanja.is.com.ua>2004-03-20 23:50:04 +0200
commit0e75717d1f95d4f19b376f23b6990f779960eb3d (patch)
tree113746404ba23ac2ebb4f74558126eb1cc0c493a /mysys/default.c
parent331ff0d8f5e092b9672f66d135d6209897b25846 (diff)
downloadmariadb-git-0e75717d1f95d4f19b376f23b6990f779960eb3d.tar.gz
fixed config parser to recognize correctly strings like following:
test="\"#no comment here"#real comment
Diffstat (limited to 'mysys/default.c')
-rw-r--r--mysys/default.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 3c9f9c823a1..e79b598101d 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -449,11 +449,12 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
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++)
{
- if (*ptr == '\'' || *ptr == '\"')
+ if ((*ptr == '\'' || *ptr == '\"') && !escape)
{
if (!quote)
quote= *ptr;
@@ -465,6 +466,7 @@ static char *remove_end_comment(char *ptr)
*ptr= 0;
return ptr;
}
+ escape= (quote && *ptr == '\\' && !escape);
}
return ptr;
}