summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
authorAnirudh Mangipudi <anirudh.mangipudi@oracle.com>2013-02-18 19:13:06 +0530
committerAnirudh Mangipudi <anirudh.mangipudi@oracle.com>2013-02-18 19:13:06 +0530
commit4061d719ec81d366ec054990c0e1850e830046fc (patch)
treece0cf3df86081d9ee313621b23492e3473d466f8 /sql/sys_vars.cc
parentf144e0fead306c31a4bf3767dad6efd4b404afbd (diff)
downloadmariadb-git-4061d719ec81d366ec054990c0e1850e830046fc.tar.gz
Bug #12546953 "SHOW VARIABLES LIKE 'DATADIR';" RETURN EMPTY.
Problem: =========================================================== If mysqld daemon is started without a --datadir option option, and we issue the SHOW VARIABLES LIKE 'DATADIR';SQL command at the client it returns an empty path. This is because mysql_real_data_home_ptr is being reset to NULL by Sys_var_charptr constructor call when the datadir is not given either through configuration file (no-defaults) or through mysqld parameters. Solution: =========================================================== mysql_real_data_home is an array which stores the path of the datadir and mysql_real_data_home_ptr is the pointer to it. The pointer is being set to NULL at the Sys_datadir, which is of type Sys_var_charptr, constructor call. This is because at Sys_datadir call the def_val parameter was being passed with DEFAULT(0) which is now replaced with DEFAULT(mysql_real_data_home). The patch has been tested manually as it is not possible to start mtr without a default config file.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 9e79cdcb6f3..2430a54ffd7 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -659,7 +659,7 @@ static Sys_var_ulong Sys_connect_timeout(
static Sys_var_charptr Sys_datadir(
"datadir", "Path to the database root directory",
READ_ONLY GLOBAL_VAR(mysql_real_data_home_ptr),
- CMD_LINE(REQUIRED_ARG, 'h'), IN_FS_CHARSET, DEFAULT(0));
+ CMD_LINE(REQUIRED_ARG, 'h'), IN_FS_CHARSET, DEFAULT(mysql_real_data_home));
#ifndef DBUG_OFF
static Sys_var_dbug Sys_dbug(