From 1c07007f0644b5579065edb3a3380d290028fd7a Mon Sep 17 00:00:00 2001 From: Ignacio Galarza Date: Thu, 6 Aug 2009 10:24:28 -0400 Subject: [PATCH] Bug #27535 Installing Windows service with --defaults-file option - quotation marks issues - Remove offensive quotes. --- sql/mysqld.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 37b3754d716..afbbf753813 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4006,15 +4006,28 @@ default_service_handling(char **argv, const char *account_name) { char path_and_service[FN_REFLEN+FN_REFLEN+32], *pos, *end; + const char *opt_delim; end= path_and_service + sizeof(path_and_service)-3; /* We have to quote filename if it contains spaces */ pos= add_quoted_string(path_and_service, file_path, end); if (*extra_opt) { - /* Add (possible quoted) option after file_path */ + /* + Add option after file_path. There will be zero or one extra option. It's + assumed to be --defaults-file=file but isn't checked. The variable (not + the option name) should be quoted if it contains a string. + */ *pos++= ' '; - pos= add_quoted_string(pos, extra_opt, end); + if (opt_delim= strchr(extra_opt, '=')) + { + size_t length= ++opt_delim - extra_opt; + strnmov(pos, extra_opt, length); + } + else + opt_delim= extra_opt; + + pos= add_quoted_string(pos, opt_delim, end); } /* We must have servicename last */ *pos++= ' ';