summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <knielsen@mysql.com>2006-06-23 14:59:40 +0200
committerunknown <knielsen@mysql.com>2006-06-23 14:59:40 +0200
commit46d19b740926d22ffa7bd3a89be81164d09b366d (patch)
tree3ae12f67ab3eb5ece06f5ed030192d8f1993b4e0
parent860c104d87424cb140d937fa2a19a5d406e264e9 (diff)
parent0f3cc95bf1523754d21cc3a4c59c0d107adc1c16 (diff)
downloadmariadb-git-46d19b740926d22ffa7bd3a89be81164d09b366d.tar.gz
Merge mysql.com:/usr/local/mysql/mysql-5.0-bug20622
into mysql.com:/usr/local/mysql/mysql-5.1-vg-apr2 mysys/mf_dirname.c: Auto merged server-tools/instance-manager/instance_options.cc: Manual merge.
-rw-r--r--mysys/mf_dirname.c4
-rw-r--r--server-tools/instance-manager/instance_options.cc9
2 files changed, 10 insertions, 3 deletions
diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c
index 378fe7080b8..43fde95554a 100644
--- a/mysys/mf_dirname.c
+++ b/mysys/mf_dirname.c
@@ -72,7 +72,9 @@ uint dirname_part(my_string to, const char *name)
SYNPOSIS
convert_dirname()
- to Store result here
+ to Store result here. Must be at least of size
+ min(FN_REFLEN, strlen(from) + 1) to make room
+ for adding FN_LIBCHAR at the end.
from Original filename. May be == to
from_end Pointer at end of filename (normally end \0)
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index b05e40734b7..c10819b51b8 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -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);