summaryrefslogtreecommitdiff
path: root/server-tools/instance-manager/instance_options.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server-tools/instance-manager/instance_options.cc')
-rw-r--r--server-tools/instance-manager/instance_options.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index b05e40734b7..576096adfd2 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -120,7 +120,7 @@ int Instance_options::get_default_option(char *result, size_t result_len,
{
int rc= 1;
LEX_STRING verbose_option=
- { C_STRING_WITH_SIZE(" --no-defaults --verbose --help") };
+ { C_STRING_WITH_LEN(" --no-defaults --verbose --help") };
/* reserve space for the path + option + final '\0' */
Buffer cmd(mysqld_path.length + verbose_option.length + 1);
@@ -155,7 +155,7 @@ int Instance_options::fill_instance_version()
{
char result[MAX_VERSION_LENGTH];
LEX_STRING version_option=
- { C_STRING_WITH_SIZE(" --no-defaults --version") };
+ { C_STRING_WITH_LEN(" --no-defaults --version") };
int rc= 1;
Buffer cmd(mysqld_path.length + version_option.length + 1);
@@ -210,7 +210,7 @@ int Instance_options::fill_mysqld_real_path()
{
char result[FN_REFLEN];
LEX_STRING help_option=
- { C_STRING_WITH_SIZE(" --no-defaults --help") };
+ { C_STRING_WITH_LEN(" --no-defaults --help") };
int rc= 1;
Buffer cmd(mysqld_path.length + help_option.length);
@@ -420,8 +420,13 @@ int Instance_options::complete_initialization(const char *default_path)
const char *tmp;
char *end;
- if (!mysqld_path.str && !(mysqld_path.str= strdup_root(&alloc, default_path)))
- goto err;
+ if (!mysqld_path.str)
+ {
+ // Need one extra byte, as convert_dirname() adds a slash at the end.
+ if (!(mysqld_path.str= alloc_root(&alloc, strlen(default_path) + 2)))
+ goto err;
+ strcpy(mysqld_path.str, default_path);
+ }
// it's safe to cast this to char* since this is a buffer we are allocating
end= convert_dirname((char*)mysqld_path.str, mysqld_path.str, NullS);