diff options
author | unknown <Reggie@vm-xp.> | 2007-04-03 15:05:33 -0500 |
---|---|---|
committer | unknown <Reggie@vm-xp.> | 2007-04-03 15:05:33 -0500 |
commit | 73fb1aed614d77539debaa0c2f4445d09b6af010 (patch) | |
tree | 8e80795cba3956d258db793c07f98605f7174270 | |
parent | 780212301367ada0b9166bf5bfdcaa2ccdb141b2 (diff) | |
download | mariadb-git-73fb1aed614d77539debaa0c2f4445d09b6af010.tar.gz |
Bug #20376 Doesn't auto-detect data dir
This changeset fixes the problem where mysql, when run as a service,
can't "detect" it's own data directory.
sql/mysqld.cc:
When running on Windows we check to see if we have a hard path in
my_progname. If not, then we use GetModuleFilename to get the full path
for the executing module. This allows the program to determine where
it's at when running as a service.
-rw-r--r-- | sql/mysqld.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5031496158b..04d4c3e76e1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7333,6 +7333,18 @@ static void mysql_init_variables(void) /* Allow Win32 and NetWare users to move MySQL anywhere */ { char prg_dev[LIBLEN]; +#if defined __WIN__ + char executing_path_name[LIBLEN]; + if (!test_if_hard_path(my_progname)) + { + // we don't want to use GetModuleFileName inside of my_path since + // my_path is a generic path dereferencing function and here we care + // only about the executing binary. + GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name)); + my_path(prg_dev, executing_path_name, NULL); + } + else +#endif my_path(prg_dev,my_progname,"mysql/bin"); strcat(prg_dev,"/../"); // Remove 'bin' to get base dir cleanup_dirname(mysql_home,prg_dev); |