mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Added checking for my.cnf file from environment variable MYSQL_HOME
instead of DATADIR. include/config-win.h: Added checks for environment variable MYSQL_HOME libmysql/Makefile.shared: Added checks for environment variable MYSQL_HOME mysys/Makefile.am: Added checks for environment variable MYSQL_HOME mysys/default.c: Removed checks for my.cnf file in datadir, instead added checking if my.cnf exists in environment variable MYSQL_HOME scripts/mysqld_multi.sh: Added checks for my.cnf file in environment variable MYSQL_HOME, if exists. scripts/mysqld_safe.sh: Added checks for my.cnf file in environment variable MYSQL_HOME, if exists.
This commit is contained in:
parent
592ffbcd68
commit
b7322badde
6 changed files with 51 additions and 23 deletions
|
|
@ -66,6 +66,7 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
|
|||
-DDATADIR="\"$(MYSQLDATAdir)\"" \
|
||||
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
|
||||
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
|
||||
-DDEFAULT_HOME_ENV=MYSQL_HOME \
|
||||
@DEFS@
|
||||
|
||||
libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
|
||||
|
|
|
|||
|
|
@ -45,23 +45,8 @@ char *defaults_extra_file=0;
|
|||
|
||||
/* Which directories are searched for options (and in which order) */
|
||||
|
||||
const char *default_directories[]= {
|
||||
#ifdef __WIN__
|
||||
"C:/",
|
||||
#elif defined(__NETWARE__)
|
||||
"sys:/etc/",
|
||||
#else
|
||||
"/etc/",
|
||||
#endif
|
||||
#ifdef DATADIR
|
||||
DATADIR,
|
||||
#endif
|
||||
"", /* Place for defaults_extra_dir */
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
"~/",
|
||||
#endif
|
||||
NullS,
|
||||
};
|
||||
#define MAX_DEFAULT_DIRS 4
|
||||
const char *default_directories[MAX_DEFAULT_DIRS + 1];
|
||||
|
||||
#ifdef __WIN__
|
||||
static const char *f_extensions[]= { ".ini", ".cnf", 0 };
|
||||
|
|
@ -89,6 +74,7 @@ static int search_default_file_with_ext(Process_option_func func,
|
|||
void *func_ctx,
|
||||
const char *dir, const char *ext,
|
||||
const char *config_file);
|
||||
static void init_default_directories();
|
||||
|
||||
static char *remove_end_comment(char *ptr);
|
||||
|
||||
|
|
@ -319,6 +305,7 @@ int load_defaults(const char *conf_file, const char **groups,
|
|||
struct handle_option_ctx ctx;
|
||||
DBUG_ENTER("load_defaults");
|
||||
|
||||
init_default_directories();
|
||||
init_alloc_root(&alloc,512,0);
|
||||
if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
|
||||
{
|
||||
|
|
@ -652,6 +639,7 @@ void print_defaults(const char *conf_file, const char **groups)
|
|||
char name[FN_REFLEN], **ext;
|
||||
const char **dirs;
|
||||
|
||||
init_default_directories();
|
||||
puts("\nDefault options are read from the following files in the given order:");
|
||||
|
||||
if (dirname_length(conf_file))
|
||||
|
|
@ -714,3 +702,23 @@ void print_defaults(const char *conf_file, const char **groups)
|
|||
}
|
||||
|
||||
#include <help_end.h>
|
||||
|
||||
static void init_default_directories()
|
||||
{
|
||||
const char *env, **ptr= default_directories;
|
||||
|
||||
#ifdef __WIN__
|
||||
*ptr++= "C:/";
|
||||
#elif defined(__NETWARE__)
|
||||
*ptr++= "sys:/etc/";
|
||||
#else
|
||||
*ptr++= "/etc/";
|
||||
#endif
|
||||
if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
|
||||
*ptr++= env;
|
||||
*ptr++= ""; /* Place for defaults_extra_file */
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
*ptr++= "~/";;
|
||||
#endif
|
||||
*ptr= 0; /* end marker */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue