diff options
author | unknown <anozdrin/alik@alik.opbmk> | 2007-02-20 21:28:30 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@alik.opbmk> | 2007-02-20 21:28:30 +0300 |
commit | ad9cd3a5fce6b361608615e3f480bc7e7813ddbb (patch) | |
tree | 3b85b381282acd24583dc6851e2907783f8ae134 /server-tools/instance-manager/manager.cc | |
parent | bae98cc8a629a2365c1517d5621cdbbc805d569b (diff) | |
download | mariadb-git-ad9cd3a5fce6b361608615e3f480bc7e7813ddbb.tar.gz |
Polishing:
1. use MySQL headers instead of system ones;
2. move logical part of code into a separate function.
server-tools/instance-manager/angel.cc:
Polishing: try not to use system headers.
Use headers from include/ directory when it is possible.
server-tools/instance-manager/manager.cc:
Polishing: move logical part of code into a separate function.
server-tools/instance-manager/manager.h:
Polishing: move logical part of code into a separate function.
server-tools/instance-manager/mysqlmanager.cc:
Polishing: rollback rename.
Diffstat (limited to 'server-tools/instance-manager/manager.cc')
-rw-r--r-- | server-tools/instance-manager/manager.cc | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc index 8c4c29d50cf..48dfa4c3571 100644 --- a/server-tools/instance-manager/manager.cc +++ b/server-tools/instance-manager/manager.cc @@ -185,6 +185,53 @@ void Manager::stop_all_threads() /** + Initialize user map and load password file. + + SYNOPSIS + init_user_map() + + RETURN + FALSE on success + TRUE on failure +*/ + +bool Manager::init_user_map(User_map *user_map) +{ + int err_code; + const char *err_msg; + + if (user_map->init()) + { + log_error("Manager: can not initialize user list: out of memory."); + return TRUE; + } + + err_code= user_map->load(Options::Main::password_file_name, &err_msg); + + if (!err_code) + return FALSE; + + if (err_code == ERR_PASSWORD_FILE_DOES_NOT_EXIST && + Options::Main::mysqld_safe_compatible) + { + /* + The password file does not exist, but we are running in + mysqld_safe-compatible mode. Continue, but complain in log. + */ + + log_info("Warning: password file does not exist, " + "nobody will be able to connect to Instance Manager."); + + return FALSE; + } + + log_error("Manager: %s.", (const char *) err_msg); + + return TRUE; +} + + +/** Main manager function. SYNOPSIS @@ -201,9 +248,7 @@ void Manager::stop_all_threads() int Manager::main() { - int err_code; int rc= 1; - const char *err_msg; bool shutdown_complete= FALSE; pid_t manager_pid= getpid(); @@ -258,33 +303,10 @@ int Manager::main() return 1; } - /* Initialize user map and load password file. */ - - if (user_map.init()) - { - log_error("Manager: can not initialize user list: out of memory."); - return 1; - } - - if ((err_code= user_map.load(Options::Main::password_file_name, &err_msg))) - { - if (err_code == ERR_PASSWORD_FILE_DOES_NOT_EXIST && - Options::Main::mysqld_safe_compatible) - { - /* - The password file does not exist, but we are running in - mysqld_safe-compatible mode. Continue, but complain in log. - */ + /* Initialize user db. */ - log_info("Warning: password file does not exist, " - "nobody will be able to connect to Instance Manager."); - } - else - { - log_error("Manager: %s.", (const char *) err_msg); - return 1; - } - } + if (init_user_map(&user_map)) + return 1; /* logging has been already done. */ /* Write Instance Manager pid file. */ |