Commit 7c35c3d5 authored by unknown's avatar unknown

Polishing:

  - change some return types from int to bool;
  - add [ERROR] tag to log_error() output;
  - add [INFO] tag to log_info() output;
  - change log messages to be more consistent.


server-tools/instance-manager/IMService.cpp:
  Log polishing.
server-tools/instance-manager/commands.cc:
  Log polishing.
server-tools/instance-manager/commands.h:
  Eliminate warnings.
server-tools/instance-manager/instance.cc:
  Log polishing.
server-tools/instance-manager/instance_map.cc:
  Log polishing.
server-tools/instance-manager/instance_options.cc:
  1) Log polishing.
  2) Change int-return type to bool.
server-tools/instance-manager/instance_options.h:
  Change int-return type to bool.
server-tools/instance-manager/listener.cc:
  Log polishing.
server-tools/instance-manager/log.cc:
  Log polishing.
server-tools/instance-manager/log.h:
  Log polishing.
server-tools/instance-manager/manager.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.h:
  Change int-return type to bool.
server-tools/instance-manager/mysqlmanager.cc:
  Log polishing.
server-tools/instance-manager/priv.cc:
  Log polishing.
server-tools/instance-manager/thread_registry.cc:
  1. Print pthread_t as (unsigned long), not as (signed long)
  to avoid negative identifiers in output.
  2. Print thread id after it will be initialized, not before.
server-tools/instance-manager/user_map.cc:
  Log polishing.
parent cbfff730
...@@ -54,24 +54,24 @@ int HandleServiceOptions() ...@@ -54,24 +54,24 @@ int HandleServiceOptions()
if (Options::Service::install_as_service) if (Options::Service::install_as_service)
{ {
if (winService.IsInstalled()) if (winService.IsInstalled())
log_info("Service is already installed"); log_info("Service is already installed.");
else if (winService.Install()) else if (winService.Install())
log_info("Service installed successfully"); log_info("Service installed successfully.");
else else
{ {
log_info("Service failed to install"); log_error("Service failed to install.");
ret_val= 1; ret_val= 1;
} }
} }
else if (Options::Service::remove_service) else if (Options::Service::remove_service)
{ {
if (! winService.IsInstalled()) if (! winService.IsInstalled())
log_info("Service is not installed"); log_info("Service is not installed.");
else if (winService.Remove()) else if (winService.Remove())
log_info("Service removed successfully"); log_info("Service removed successfully.");
else else
{ {
log_info("Service failed to remove"); log_error("Service failed to remove.");
ret_val= 1; ret_val= 1;
} }
} }
...@@ -81,7 +81,7 @@ int HandleServiceOptions() ...@@ -81,7 +81,7 @@ int HandleServiceOptions()
if (!winService.Init()) if (!winService.Init())
{ {
log_info("Service failed to initialize."); log_error("Service failed to initialize.");
fprintf(stderr, fprintf(stderr,
"The service should be started by Windows Service Manager.\n" "The service should be started by Windows Service Manager.\n"
"The MySQL Manager should be started with '--standalone'\n" "The MySQL Manager should be started with '--standalone'\n"
......
...@@ -1539,7 +1539,7 @@ int Set_option::process_option(Instance *instance, Named_value *option) ...@@ -1539,7 +1539,7 @@ int Set_option::process_option(Instance *instance, Named_value *option)
if (instance->is_mysqld_compatible() && if (instance->is_mysqld_compatible() &&
Instance_options::is_option_im_specific(option->get_name())) Instance_options::is_option_im_specific(option->get_name()))
{ {
log_error("Error: IM-option (%s) can not be used " log_error("IM-option (%s) can not be used "
"in the configuration of mysqld-compatible instance (%s).", "in the configuration of mysqld-compatible instance (%s).",
(const char *) option->get_name(), (const char *) option->get_name(),
(const char *) instance->get_name()->str); (const char *) instance->get_name()->str);
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
class Show_instances: public Command class Show_instances: public Command
{ {
public:
Show_instances()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
...@@ -53,6 +57,10 @@ private: ...@@ -53,6 +57,10 @@ private:
class Flush_instances: public Command class Flush_instances: public Command
{ {
public:
Flush_instances()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
}; };
...@@ -311,6 +319,10 @@ private: ...@@ -311,6 +319,10 @@ private:
class Set_option: public Abstract_option_cmd class Set_option: public Abstract_option_cmd
{ {
public:
Set_option()
{ }
protected: protected:
virtual bool parse_args(const char **text); virtual bool parse_args(const char **text);
virtual int process_option(Instance *instance, Named_value *option); virtual int process_option(Instance *instance, Named_value *option);
...@@ -324,6 +336,10 @@ protected: ...@@ -324,6 +336,10 @@ protected:
class Unset_option: public Abstract_option_cmd class Unset_option: public Abstract_option_cmd
{ {
public:
Unset_option()
{ }
protected: protected:
virtual bool parse_args(const char **text); virtual bool parse_args(const char **text);
virtual int process_option(Instance *instance, Named_value *option); virtual int process_option(Instance *instance, Named_value *option);
...@@ -341,6 +357,10 @@ protected: ...@@ -341,6 +357,10 @@ protected:
class Syntax_error: public Command class Syntax_error: public Command
{ {
public:
Syntax_error()
{ }
public: public:
int execute(st_net *net, ulong connection_id); int execute(st_net *net, ulong connection_id);
}; };
......
...@@ -170,7 +170,7 @@ static bool start_process(Instance_options *instance_options, ...@@ -170,7 +170,7 @@ static bool start_process(Instance_options *instance_options,
/* exec never returns */ /* exec never returns */
exit(1); exit(1);
case -1: case -1:
log_info("Instance '%s': can not start mysqld: fork() failed.", log_error("Instance '%s': can not start mysqld: fork() failed.",
(const char *) instance_options->instance_name.str); (const char *) instance_options->instance_name.str);
return TRUE; return TRUE;
} }
...@@ -699,10 +699,9 @@ void Instance::kill_mysqld(int signum) ...@@ -699,10 +699,9 @@ void Instance::kill_mysqld(int signum)
/* Kill suceeded */ /* Kill suceeded */
if (signum == SIGKILL) /* really killed instance with SIGKILL */ if (signum == SIGKILL) /* really killed instance with SIGKILL */
{ {
log_error("The instance '%s' is being stopped forcibly. Normally" log_error("Instance '%s': killed.",
"it should not happen. Probably the instance has been"
"hanging. You should also check your IM setup",
(const char *) options.instance_name.str); (const char *) options.instance_name.str);
/* After sucessful hard kill the pidfile need to be removed */ /* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile(); options.unlink_pidfile();
} }
......
...@@ -336,14 +336,14 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, ...@@ -336,14 +336,14 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
if (!instance) if (!instance)
{ {
log_error("Error: can not allocate instance (name: '%s').", log_error("Can not allocate instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
} }
if (instance->init(instance_name)) if (instance->init(instance_name))
{ {
log_error("Error: can not initialize instance (name: '%s').", log_error("Can not initialize instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
delete instance; delete instance;
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
...@@ -356,7 +356,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, ...@@ -356,7 +356,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
if (instance->is_mysqld_compatible() && if (instance->is_mysqld_compatible() &&
Instance_options::is_option_im_specific(option.get_name())) Instance_options::is_option_im_specific(option.get_name()))
{ {
log_error("Error: IM-option (%s) can not be used " log_error("IM-option (%s) can not be used "
"in configuration of mysqld-compatible instance (%s).", "in configuration of mysqld-compatible instance (%s).",
(const char *) option.get_name(), (const char *) option.get_name(),
(const char *) instance_name->str); (const char *) instance_name->str);
...@@ -373,7 +373,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, ...@@ -373,7 +373,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
if (instance->complete_initialization()) if (instance->complete_initialization())
{ {
log_error("Error: can not complete initialization of instance (name: '%s').", log_error("Can not complete initialization of instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
delete instance; delete instance;
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
...@@ -382,7 +382,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, ...@@ -382,7 +382,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
if (add_instance(instance)) if (add_instance(instance))
{ {
log_error("Error: can not register instance (name: '%s').", log_error("Can not register instance (name: '%s').",
(const char *) instance_name->str); (const char *) instance_name->str);
delete instance; delete instance;
return ER_OUT_OF_RESOURCES; return ER_OUT_OF_RESOURCES;
...@@ -426,7 +426,7 @@ bool Instance_map::complete_initialization() ...@@ -426,7 +426,7 @@ bool Instance_map::complete_initialization()
if (create_instance(&Instance::DFLT_INSTANCE_NAME, NULL)) if (create_instance(&Instance::DFLT_INSTANCE_NAME, NULL))
{ {
log_error("Error: could not create default instance."); log_error("Can not create default instance.");
return TRUE; return TRUE;
} }
...@@ -441,7 +441,7 @@ bool Instance_map::complete_initialization() ...@@ -441,7 +441,7 @@ bool Instance_map::complete_initialization()
break; break;
default: default:
log_error("Error: could not add default instance to the config file."); log_error("Can not add default instance to the config file.");
Instance *instance= find(&Instance::DFLT_INSTANCE_NAME); Instance *instance= find(&Instance::DFLT_INSTANCE_NAME);
...@@ -499,7 +499,7 @@ int Instance_map::load() ...@@ -499,7 +499,7 @@ int Instance_map::load()
if (my_search_option_files(Options::Main::config_file, &argc, if (my_search_option_files(Options::Main::config_file, &argc,
(char ***) &argv, &args_used, (char ***) &argv, &args_used,
process_option, (void*) this)) process_option, (void*) this))
log_info("Falling back to compiled-in defaults"); log_info("Falling back to compiled-in defaults.");
return complete_initialization(); return complete_initialization();
} }
...@@ -566,7 +566,7 @@ int create_instance_in_file(const LEX_STRING *instance_name, ...@@ -566,7 +566,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
if (my_access(Options::Main::config_file, W_OK)) if (my_access(Options::Main::config_file, W_OK))
{ {
log_error("Error: configuration file (%s) does not exist.", log_error("Configuration file (%s) does not exist.",
(const char *) Options::Main::config_file); (const char *) Options::Main::config_file);
return ER_CONF_FILE_DOES_NOT_EXIST; return ER_CONF_FILE_DOES_NOT_EXIST;
} }
...@@ -575,7 +575,7 @@ int create_instance_in_file(const LEX_STRING *instance_name, ...@@ -575,7 +575,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
if (cnf_file <= 0) if (cnf_file <= 0)
{ {
log_error("Error: can not open configuration file (%s): %s.", log_error("Can not open configuration file (%s): %s.",
(const char *) Options::Main::config_file, (const char *) Options::Main::config_file,
(const char *) strerror(errno)); (const char *) strerror(errno));
return ER_ACCESS_OPTION_FILE; return ER_ACCESS_OPTION_FILE;
...@@ -588,7 +588,7 @@ int create_instance_in_file(const LEX_STRING *instance_name, ...@@ -588,7 +588,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
my_write(cnf_file, (byte*)"]", 1, MYF(MY_NABP)) || my_write(cnf_file, (byte*)"]", 1, MYF(MY_NABP)) ||
my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
{ {
log_error("Error: can not write to configuration file (%s): %s.", log_error("Can not write to configuration file (%s): %s.",
(const char *) Options::Main::config_file, (const char *) Options::Main::config_file,
(const char *) strerror(errno)); (const char *) strerror(errno));
my_close(cnf_file, MYF(0)); my_close(cnf_file, MYF(0));
...@@ -612,7 +612,7 @@ int create_instance_in_file(const LEX_STRING *instance_name, ...@@ -612,7 +612,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
if (my_write(cnf_file, (byte*)option_str, option_str_len, MYF(MY_NABP)) || if (my_write(cnf_file, (byte*)option_str, option_str_len, MYF(MY_NABP)) ||
my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
{ {
log_error("Error: can not write to configuration file (%s): %s.", log_error("Can not write to configuration file (%s): %s.",
(const char *) Options::Main::config_file, (const char *) Options::Main::config_file,
(const char *) strerror(errno)); (const char *) strerror(errno));
my_close(cnf_file, MYF(0)); my_close(cnf_file, MYF(0));
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* Create "mysqld ..." command in the buffer */ /* Create "mysqld ..." command in the buffer */
static inline int create_mysqld_command(Buffer *buf, static inline bool create_mysqld_command(Buffer *buf,
const LEX_STRING *mysqld_path, const LEX_STRING *mysqld_path,
const LEX_STRING *option) const LEX_STRING *option)
{ {
...@@ -55,9 +55,9 @@ static inline int create_mysqld_command(Buffer *buf, ...@@ -55,9 +55,9 @@ static inline int create_mysqld_command(Buffer *buf,
/* here the '\0' character is copied from the option string */ /* here the '\0' character is copied from the option string */
buf->append(position, option->str, option->length + 1); buf->append(position, option->str, option->length + 1);
return buf->is_error(); return buf->is_error() ? TRUE : FALSE;
} }
return 1; return TRUE;
} }
...@@ -152,27 +152,36 @@ err: ...@@ -152,27 +152,36 @@ err:
Get mysqld version string from "mysqld --version" output. Get mysqld version string from "mysqld --version" output.
RETURN RETURN
0 - ok FALSE - ok
1 - error occured TRUE - error occured
*/ */
int Instance_options::fill_instance_version() bool Instance_options::fill_instance_version()
{ {
char result[MAX_VERSION_LENGTH]; char result[MAX_VERSION_LENGTH];
LEX_STRING version_option= LEX_STRING version_option=
{ C_STRING_WITH_LEN(" --no-defaults --version") }; { C_STRING_WITH_LEN(" --no-defaults --version") };
int rc= 1;
Buffer cmd(mysqld_path.length + version_option.length + 1); Buffer cmd(mysqld_path.length + version_option.length + 1);
if (create_mysqld_command(&cmd, &mysqld_path, &version_option)) if (create_mysqld_command(&cmd, &mysqld_path, &version_option))
goto err; {
log_error("Failed to get version of '%s': out of memory.",
(const char *) mysqld_path.str);
return TRUE;
}
bzero(result, MAX_VERSION_LENGTH); bzero(result, MAX_VERSION_LENGTH);
rc= parse_output_and_get_value(cmd.buffer, "Ver", result, if (parse_output_and_get_value(cmd.buffer, "Ver", result,
MAX_VERSION_LENGTH, GET_LINE); MAX_VERSION_LENGTH, GET_LINE))
{
log_error("Failed to get version of '%s': unexpected output.",
(const char *) mysqld_path.str);
return TRUE;
}
DBUG_ASSERT(*result != '\0');
if (*result != '\0')
{ {
char *start; char *start;
/* chop the newline from the end of the version string */ /* chop the newline from the end of the version string */
...@@ -184,11 +193,8 @@ int Instance_options::fill_instance_version() ...@@ -184,11 +193,8 @@ int Instance_options::fill_instance_version()
mysqld_version= strdup_root(&alloc, start); mysqld_version= strdup_root(&alloc, start);
} }
err:
if (rc) return FALSE;
log_error("fill_instance_version: Failed to get version of '%s'",
(const char *) mysqld_path.str);
return rc;
} }
...@@ -207,28 +213,37 @@ err: ...@@ -207,28 +213,37 @@ err:
script(for example libtool) or a symlink. script(for example libtool) or a symlink.
RETURN RETURN
0 - ok FALSE - ok
1 - error occured TRUE - error occured
*/ */
int Instance_options::fill_mysqld_real_path() bool Instance_options::fill_mysqld_real_path()
{ {
char result[FN_REFLEN]; char result[FN_REFLEN];
LEX_STRING help_option= LEX_STRING help_option=
{ C_STRING_WITH_LEN(" --no-defaults --help") }; { C_STRING_WITH_LEN(" --no-defaults --help") };
int rc= 1;
Buffer cmd(mysqld_path.length + help_option.length); Buffer cmd(mysqld_path.length + help_option.length);
if (create_mysqld_command(&cmd, &mysqld_path, &help_option)) if (create_mysqld_command(&cmd, &mysqld_path, &help_option))
goto err; {
log_error("Failed to get real path of '%s': out of memory.",
(const char *) mysqld_path.str);
return TRUE;
}
bzero(result, FN_REFLEN); bzero(result, FN_REFLEN);
rc= parse_output_and_get_value(cmd.buffer, "Usage: ", if (parse_output_and_get_value(cmd.buffer, "Usage: ",
result, FN_REFLEN, result, FN_REFLEN,
GET_LINE); GET_LINE))
{
log_error("Failed to get real path of '%s': unexpected output.",
(const char *) mysqld_path.str);
return TRUE;
}
DBUG_ASSERT(*result != '\0');
if (*result != '\0')
{ {
char* options_str; char* options_str;
/* chop the path of at [OPTIONS] */ /* chop the path of at [OPTIONS] */
...@@ -237,10 +252,8 @@ int Instance_options::fill_mysqld_real_path() ...@@ -237,10 +252,8 @@ int Instance_options::fill_mysqld_real_path()
mysqld_real_path.str= strdup_root(&alloc, result); mysqld_real_path.str= strdup_root(&alloc, result);
mysqld_real_path.length= strlen(mysqld_real_path.str); mysqld_real_path.length= strlen(mysqld_real_path.str);
} }
err:
if (rc) return FALSE;
log_error("fill_mysqld_real_path: Failed to get real path of mysqld");
return rc;
} }
...@@ -257,11 +270,11 @@ err: ...@@ -257,11 +270,11 @@ err:
file name and placement. file name and placement.
RETURN RETURN
0 - ok FALSE - ok
1 - error occured TRUE - error occured
*/ */
int Instance_options::fill_log_options() bool Instance_options::fill_log_options()
{ {
Buffer buff; Buffer buff;
enum { MAX_LOG_OPTION_LENGTH= 256 }; enum { MAX_LOG_OPTION_LENGTH= 256 };
...@@ -287,7 +300,7 @@ int Instance_options::fill_log_options() ...@@ -287,7 +300,7 @@ int Instance_options::fill_log_options()
if (mysqld_datadir == NULL) if (mysqld_datadir == NULL)
{ {
if (get_default_option(datadir, MAX_LOG_OPTION_LENGTH, "--datadir")) if (get_default_option(datadir, MAX_LOG_OPTION_LENGTH, "--datadir"))
goto err; return TRUE;
} }
else else
{ {
...@@ -325,7 +338,7 @@ int Instance_options::fill_log_options() ...@@ -325,7 +338,7 @@ int Instance_options::fill_log_options()
if ((MAX_LOG_OPTION_LENGTH - strlen(full_name)) <= if ((MAX_LOG_OPTION_LENGTH - strlen(full_name)) <=
strlen(log_files->default_suffix)) strlen(log_files->default_suffix))
goto err; return TRUE;
strmov(full_name + strlen(full_name), log_files->default_suffix); strmov(full_name + strlen(full_name), log_files->default_suffix);
...@@ -345,15 +358,13 @@ int Instance_options::fill_log_options() ...@@ -345,15 +358,13 @@ int Instance_options::fill_log_options()
datadir, "", MY_UNPACK_FILENAME | MY_SAFE_PATH); datadir, "", MY_UNPACK_FILENAME | MY_SAFE_PATH);
if (!(*(log_files->value)= strdup_root(&alloc, full_name))) if (!(*(log_files->value)= strdup_root(&alloc, full_name)))
goto err; return TRUE;
} }
} }
} }
} }
return 0; return FALSE;
err:
return 1;
} }
......
...@@ -91,9 +91,9 @@ public: ...@@ -91,9 +91,9 @@ public:
char *logs[3]; char *logs[3];
private: private:
int fill_log_options(); bool fill_log_options();
int fill_instance_version(); bool fill_instance_version();
int fill_mysqld_real_path(); bool fill_mysqld_real_path();
int add_to_argv(const char *option); int add_to_argv(const char *option);
int get_default_option(char *result, size_t result_len, int get_default_option(char *result, size_t result_len,
const char *option_name); const char *option_name);
......
...@@ -127,8 +127,8 @@ void Listener::run() ...@@ -127,8 +127,8 @@ void Listener::run()
if (rc == 0 || rc == -1) if (rc == 0 || rc == -1)
{ {
if (rc == -1 && errno != EINTR) if (rc == -1 && errno != EINTR)
log_error("Listener: select() failed, %s", log_error("Listener: select() failed: %s.",
strerror(errno)); (const char *) strerror(errno));
continue; continue;
} }
...@@ -195,8 +195,8 @@ int Listener::create_tcp_socket() ...@@ -195,8 +195,8 @@ int Listener::create_tcp_socket()
int ip_socket= socket(AF_INET, SOCK_STREAM, 0); int ip_socket= socket(AF_INET, SOCK_STREAM, 0);
if (ip_socket == INVALID_SOCKET) if (ip_socket == INVALID_SOCKET)
{ {
log_error("Listener_thead: socket(AF_INET) failed, %s", log_error("Listener: socket(AF_INET) failed: %s.",
strerror(errno)); (const char *) strerror(errno));
return -1; return -1;
} }
...@@ -226,16 +226,16 @@ int Listener::create_tcp_socket() ...@@ -226,16 +226,16 @@ int Listener::create_tcp_socket()
if (bind(ip_socket, (struct sockaddr *) &ip_socket_address, if (bind(ip_socket, (struct sockaddr *) &ip_socket_address,
sizeof(ip_socket_address))) sizeof(ip_socket_address)))
{ {
log_error("Listener: bind(ip socket) failed, '%s'", log_error("Listener: bind(ip socket) failed: %s.",
strerror(errno)); (const char *) strerror(errno));
close(ip_socket); close(ip_socket);
return -1; return -1;
} }
if (listen(ip_socket, LISTEN_BACK_LOG_SIZE)) if (listen(ip_socket, LISTEN_BACK_LOG_SIZE))
{ {
log_error("Listener: listen(ip socket) failed, %s", log_error("Listener: listen(ip socket) failed: %s.",
strerror(errno)); (const char *) strerror(errno));
close(ip_socket); close(ip_socket);
return -1; return -1;
} }
...@@ -248,7 +248,8 @@ int Listener::create_tcp_socket() ...@@ -248,7 +248,8 @@ int Listener::create_tcp_socket()
FD_SET(ip_socket, &read_fds); FD_SET(ip_socket, &read_fds);
sockets[num_sockets++]= ip_socket; sockets[num_sockets++]= ip_socket;
log_info("accepting connections on ip socket (port: %d)", (int) im_port); log_info("Listener: accepting connections on ip socket (port: %d)...",
(int) im_port);
return 0; return 0;
} }
...@@ -259,8 +260,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -259,8 +260,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
int unix_socket= socket(AF_UNIX, SOCK_STREAM, 0); int unix_socket= socket(AF_UNIX, SOCK_STREAM, 0);
if (unix_socket == INVALID_SOCKET) if (unix_socket == INVALID_SOCKET)
{ {
log_error("Listener_thead: socket(AF_UNIX) failed, %s", log_error("Listener: socket(AF_UNIX) failed: %s.",
strerror(errno)); (const char *) strerror(errno));
return -1; return -1;
} }
...@@ -279,9 +280,9 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -279,9 +280,9 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
if (bind(unix_socket, (struct sockaddr *) &unix_socket_address, if (bind(unix_socket, (struct sockaddr *) &unix_socket_address,
sizeof(unix_socket_address))) sizeof(unix_socket_address)))
{ {
log_error("Listener: bind(unix socket) failed, " log_error("Listener: bind(unix socket) failed for '%s': %s.",
"socket file name is '%s', error '%s'", (const char *) unix_socket_address.sun_path,
unix_socket_address.sun_path, strerror(errno)); (const char *) strerror(errno));
close(unix_socket); close(unix_socket);
return -1; return -1;
} }
...@@ -290,8 +291,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -290,8 +291,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
if (listen(unix_socket, LISTEN_BACK_LOG_SIZE)) if (listen(unix_socket, LISTEN_BACK_LOG_SIZE))
{ {
log_error("Listener: listen(unix socket) failed, %s", log_error("Listener: listen(unix socket) failed: %s.",
strerror(errno)); (const char *) strerror(errno));
close(unix_socket); close(unix_socket);
return -1; return -1;
} }
...@@ -302,8 +303,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -302,8 +303,8 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
/* make sure that instances won't be listening our sockets */ /* make sure that instances won't be listening our sockets */
set_no_inherit(unix_socket); set_no_inherit(unix_socket);
log_info("accepting connections on unix socket '%s'", log_info("Listener: accepting connections on unix socket '%s'...",
unix_socket_address.sun_path); (const char *) unix_socket_address.sun_path);
sockets[num_sockets++]= unix_socket; sockets[num_sockets++]= unix_socket;
FD_SET(unix_socket, &read_fds); FD_SET(unix_socket, &read_fds);
return 0; return 0;
...@@ -325,7 +326,7 @@ void Listener::handle_new_mysql_connection(struct st_vio *vio) ...@@ -325,7 +326,7 @@ void Listener::handle_new_mysql_connection(struct st_vio *vio)
vio, ++total_connection_count); vio, ++total_connection_count);
if (mysql_connection == NULL || mysql_connection->start(Thread::DETACHED)) if (mysql_connection == NULL || mysql_connection->start(Thread::DETACHED))
{ {
log_error("handle_one_mysql_connection() failed"); log_error("Listener: can not start connection handler.");
delete mysql_connection; delete mysql_connection;
vio_delete(vio); vio_delete(vio);
} }
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
log() log()
*/ */
static inline void log(FILE *file, const char *format, va_list args) static void log(FILE *file,const char *level_tag, const char *format,
va_list args)
{ {
/* /*
log() should be thread-safe; it implies that we either call fprintf() log() should be thread-safe; it implies that we either call fprintf()
...@@ -53,15 +54,16 @@ static inline void log(FILE *file, const char *format, va_list args) ...@@ -53,15 +54,16 @@ static inline void log(FILE *file, const char *format, va_list args)
localtime_r(&now, &bd_time); localtime_r(&now, &bd_time);
char buff_date[128]; char buff_date[128];
sprintf(buff_date, "[%d/%lu] [%02d/%02d/%02d %02d:%02d:%02d] ", sprintf(buff_date, "[%d/%lu] [%02d/%02d/%02d %02d:%02d:%02d] [%s] ",
(int) getpid(), (int) getpid(),
(unsigned long) pthread_self(), (unsigned long) pthread_self(),
bd_time.tm_year % 100, (int) bd_time.tm_year % 100,
bd_time.tm_mon + 1, (int) bd_time.tm_mon + 1,
bd_time.tm_mday, (int) bd_time.tm_mday,
bd_time.tm_hour, (int) bd_time.tm_hour,
bd_time.tm_min, (int) bd_time.tm_min,
bd_time.tm_sec); (int) bd_time.tm_sec,
(const char *) level_tag);
/* Format the message */ /* Format the message */
char buff_stack[256]; char buff_stack[256];
...@@ -109,57 +111,73 @@ static inline void log(FILE *file, const char *format, va_list args) ...@@ -109,57 +111,73 @@ static inline void log(FILE *file, const char *format, va_list args)
/* don't fflush() the file: buffering strategy is set in log_init() */ /* don't fflush() the file: buffering strategy is set in log_init() */
} }
/**************************************************************************
Logging: implementation of public interface.
**************************************************************************/
void log_error(const char *format, ...) /*
{ The function initializes logging sub-system.
va_list args;
va_start(args, format);
log(stderr, format, args);
va_end(args);
}
SYNOPSIS
log_init()
*/
void log_info(const char *format, ...) void log_init()
{ {
va_list args; /*
va_start(args, format); stderr is unbuffered by default; there is no good of line buffering,
log(stdout, format, args); as all logging is performed linewise - so remove buffering from stdout
va_end(args); also
*/
setbuf(stdout, 0);
} }
/* TODO: rewrite with buffering print */
void print_info(const char *format, ...) /*
The function is intended to log error messages. It precedes a message
with date, time and [ERROR] tag and print it to the stderr.
SYNOPSIS
log_error()
format [IN] format string
... [IN] arguments to format
*/
void log_error(const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vfprintf(stdout, format, args); log(stderr, "ERROR", format, args);
va_end(args); va_end(args);
} }
void print_error(const char *format, ...)
/*
The function is intended to log information messages. It precedes
a message with date, time and [INFO] tag and print it to the stdout.
SYNOPSIS
log_error()
format [IN] format string
... [IN] arguments to format
*/
void log_info(const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vfprintf(stderr, format, args); log(stdout, "INFO", format, args);
va_end(args); va_end(args);
} }
/* /*
log_init() The function prints information to the error log and eixt(1).
RETURN VALUE
0 ok
!0 error
*/
void log_init() SYNOPSIS
{ die()
/* format [IN] format string
stderr is unbuffered by default; there is no good of line buffering, ... [IN] arguments to format
as all logging is performed linewise - so remove buffering from stdout */
also
*/
setbuf(stdout, 0);
}
void die(const char *format, ...) void die(const char *format, ...)
{ {
......
...@@ -19,20 +19,23 @@ ...@@ -19,20 +19,23 @@
/* /*
Logging facilities. Logging facilities.
Two logging streams are supported: error log and info log. Additionally Two logging streams are supported: error log and info log.
libdbug may be used for debug information output. Additionally libdbug may be used for debug information output.
ANSI C buffered I/O is used to perform logging. ANSI C buffered I/O is used to perform logging.
Logging is performed via stdout/stder, so one can reopen them to point to Logging is performed via stdout/stder, so one can reopen them to point to
ordinary files. To initialize loggin environment log_init() must be called. ordinary files. To initialize logging environment log_init() must be called.
Rationale: Rationale:
- no MYSQL_LOG as it has BIN mode, and not easy to fetch from sql_class.h - no MYSQL_LOG as it has BIN mode, and not easy to fetch from sql_class.h
- no constructors/desctructors to make logging available all the time - no constructors/desctructors to make logging available all the time
Function names are subject to change.
*/ */
/* Precede error message with date and time and print it to the stdout */ void log_init();
void log_info(const char *format, ...) void log_info(const char *format, ...)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((format(printf, 1, 2))) __attribute__ ((format(printf, 1, 2)))
...@@ -40,7 +43,6 @@ void log_info(const char *format, ...) ...@@ -40,7 +43,6 @@ void log_info(const char *format, ...)
; ;
/* Precede error message with date and time and print it to the stderr */
void log_error(const char *format, ...) void log_error(const char *format, ...)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((format (printf, 1, 2))) __attribute__ ((format (printf, 1, 2)))
...@@ -48,30 +50,6 @@ void log_error(const char *format, ...) ...@@ -48,30 +50,6 @@ void log_error(const char *format, ...)
; ;
/*
Now this is simple catchouts for printf (no date/time is logged), to be
able to replace underlying streams in future.
*/
void print_info(const char *format, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
void print_error(const char *format, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
/* initialize logs */
void log_init();
/* print information to the error log and eixt(1) */
void die(const char *format, ...) void die(const char *format, ...)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((format (printf, 1, 2))) __attribute__ ((format (printf, 1, 2)))
......
...@@ -185,7 +185,7 @@ int Manager::main() ...@@ -185,7 +185,7 @@ int Manager::main()
if (check_if_linux_threads(&linux_threads)) if (check_if_linux_threads(&linux_threads))
{ {
log_error("Error: can not check if Linux Threads are used."); log_error("Can not determine thread model.");
return 1; return 1;
} }
...@@ -215,7 +215,7 @@ int Manager::main() ...@@ -215,7 +215,7 @@ int Manager::main()
if (instance_map.init()) if (instance_map.init())
{ {
log_error("Error: can not initialize instance list: out of memory."); log_error("Can not initialize instance list: out of memory.");
return 1; return 1;
} }
...@@ -223,7 +223,7 @@ int Manager::main() ...@@ -223,7 +223,7 @@ int Manager::main()
if (user_map.init()) if (user_map.init())
{ {
log_error("Error: can not initialize user list: out of memory."); log_error("Can not initialize user list: out of memory.");
return 1; return 1;
} }
...@@ -237,12 +237,12 @@ int Manager::main() ...@@ -237,12 +237,12 @@ int Manager::main()
mysqld_safe-compatible mode. Continue, but complain in log. mysqld_safe-compatible mode. Continue, but complain in log.
*/ */
log_error("Warning: password file does not exist, " log_info("Warning: password file does not exist, "
"nobody will be able to connect to Instance Manager."); "nobody will be able to connect to Instance Manager.");
} }
else else
{ {
log_error("Error: %s.", (const char *) err_msg); log_error("%s.", (const char *) err_msg);
return 1; return 1;
} }
} }
...@@ -290,7 +290,7 @@ int Manager::main() ...@@ -290,7 +290,7 @@ int Manager::main()
*/ */
if (guardian.start(Thread::DETACHED)) if (guardian.start(Thread::DETACHED))
{ {
log_error("Error: can not start Guardian thread."); log_error("Can not start Guardian thread.");
goto err; goto err;
} }
...@@ -307,7 +307,7 @@ int Manager::main() ...@@ -307,7 +307,7 @@ int Manager::main()
if (flush_instances_status) if (flush_instances_status)
{ {
log_error("Error: can not init instances repository."); log_error("Can not init instances repository.");
stop_all_threads(); stop_all_threads();
goto err; goto err;
} }
...@@ -317,7 +317,7 @@ int Manager::main() ...@@ -317,7 +317,7 @@ int Manager::main()
if (listener.start(Thread::DETACHED)) if (listener.start(Thread::DETACHED))
{ {
log_error("Error: can not start Listener thread."); log_error("Can not start Listener thread.");
stop_all_threads(); stop_all_threads();
goto err; goto err;
} }
...@@ -339,7 +339,7 @@ int Manager::main() ...@@ -339,7 +339,7 @@ int Manager::main()
if ((status= my_sigwait(&mask, &signo)) != 0) if ((status= my_sigwait(&mask, &signo)) != 0)
{ {
log_error("Error: sigwait() failed"); log_error("sigwait() failed");
stop_all_threads(); stop_all_threads();
goto err; goto err;
} }
......
...@@ -77,24 +77,30 @@ C_MODE_END ...@@ -77,24 +77,30 @@ C_MODE_END
This function is complementary to cleanup(). This function is complementary to cleanup().
*/ */
int Mysql_connection::init() bool Mysql_connection::init()
{ {
/* Allocate buffers for network I/O */ /* Allocate buffers for network I/O */
if (my_net_init(&net, vio)) if (my_net_init(&net, vio))
return 1; return TRUE;
net.return_status= &status; net.return_status= &status;
/* Initialize random number generator */ /* Initialize random number generator */
{ {
ulong seed1= (ulong) &rand_st + rand(); ulong seed1= (ulong) &rand_st + rand();
ulong seed2= (ulong) rand() + time(0); ulong seed2= (ulong) rand() + time(0);
randominit(&rand_st, seed1, seed2); randominit(&rand_st, seed1, seed2);
} }
/* Fill scramble - server's random message used for handshake */ /* Fill scramble - server's random message used for handshake */
create_random_string(scramble, SCRAMBLE_LENGTH, &rand_st); create_random_string(scramble, SCRAMBLE_LENGTH, &rand_st);
/* We don't support transactions, every query is atomic */ /* We don't support transactions, every query is atomic */
status= SERVER_STATUS_AUTOCOMMIT; status= SERVER_STATUS_AUTOCOMMIT;
thread_registry->register_thread(&thread_info); thread_registry->register_thread(&thread_info);
return 0;
return FALSE;
} }
...@@ -114,12 +120,17 @@ Mysql_connection::~Mysql_connection() ...@@ -114,12 +120,17 @@ Mysql_connection::~Mysql_connection()
void Mysql_connection::main() void Mysql_connection::main()
{ {
log_info("accepted mysql connection %lu", (unsigned long) connection_id); log_info("Connection %lu: accepted.", (unsigned long) connection_id);
if (check_connection()) if (check_connection())
{
log_info("Connection %lu: failed to authorize the user.",
(unsigned long) connection_id);
return; return;
}
log_info("connection %lu is checked successfully", log_info("Connection %lu: the user was authorized successfully.",
(unsigned long) connection_id); (unsigned long) connection_id);
vio_keepalive(vio, TRUE); vio_keepalive(vio, TRUE);
...@@ -257,8 +268,11 @@ int Mysql_connection::do_command() ...@@ -257,8 +268,11 @@ int Mysql_connection::do_command()
packet= (char*) net.read_pos; packet= (char*) net.read_pos;
enum enum_server_command command= (enum enum_server_command) enum enum_server_command command= (enum enum_server_command)
(uchar) *packet; (uchar) *packet;
log_info("connection %d: packet_length=%d, command=%d", log_info("Connection %lu: received packet (length: %lu; command: %d).",
(int) connection_id, (int) packet_length, (int) command); (unsigned long) connection_id,
(unsigned long) packet_length,
(int) command);
return dispatch_command(command, packet + 1); return dispatch_command(command, packet + 1);
} }
} }
...@@ -268,63 +282,81 @@ int Mysql_connection::dispatch_command(enum enum_server_command command, ...@@ -268,63 +282,81 @@ int Mysql_connection::dispatch_command(enum enum_server_command command,
{ {
switch (command) { switch (command) {
case COM_QUIT: // client exit case COM_QUIT: // client exit
log_info("query for connection %lu received quit command", log_info("Connection %lu: received QUIT command.",
(unsigned long) connection_id); (unsigned long) connection_id);
return 1; return 1;
case COM_PING: case COM_PING:
log_info("query for connection %lu received ping command", log_info("Connection %lu: received PING command.",
(unsigned long) connection_id); (unsigned long) connection_id);
net_send_ok(&net, connection_id, NULL); net_send_ok(&net, connection_id, NULL);
break; return 0;
case COM_QUERY: case COM_QUERY:
{ {
log_info("query for connection %d : ----\n%s\n-------------------------", log_info("Connection %lu: received QUERY command: '%s'.",
(int) connection_id, (unsigned long) connection_id,
(const char *) packet); (const char *) packet);
if (Command *command= parse_command(packet)) if (Command *command= parse_command(packet))
{ {
int res= 0; int res= 0;
log_info("query for connection %lu successfully parsed",
log_info("Connection %lu: query parsed successfully.",
(unsigned long) connection_id); (unsigned long) connection_id);
res= command->execute(&net, connection_id); res= command->execute(&net, connection_id);
delete command; delete command;
if (!res) if (!res)
log_info("query for connection %lu executed ok", {
log_info("Connection %lu: query executed successfully",
(unsigned long) connection_id); (unsigned long) connection_id);
}
else else
{ {
log_info("query for connection %lu executed err=%d", log_info("Connection %lu: can not execute query (error: %d).",
(unsigned long) connection_id, (int) res); (unsigned long) connection_id,
(int) res);
net_send_error(&net, res); net_send_error(&net, res);
return 0;
} }
} }
else else
{ {
log_error("Connection %lu: can not parse query: out ot resources.",
(unsigned long) connection_id);
net_send_error(&net,ER_OUT_OF_RESOURCES); net_send_error(&net,ER_OUT_OF_RESOURCES);
return 0;
} }
break;
return 0;
} }
default: default:
log_info("query for connection %lu received unknown command", log_info("Connection %lu: received unsupported command (%d).",
(unsigned long) connection_id); (unsigned long) connection_id,
(int) command);
net_send_error(&net, ER_UNKNOWN_COM_ERROR); net_send_error(&net, ER_UNKNOWN_COM_ERROR);
break;
}
return 0; return 0;
}
return 0; /* Just to make compiler happy. */
} }
void Mysql_connection::run() void Mysql_connection::run()
{ {
if (init()) if (init())
log_info("Mysql_connection::run(): error initializing thread"); log_error("Connection %lu: can not init handler.",
(unsigned long) connection_id);
else else
{ {
main(); main();
cleanup(); cleanup();
} }
delete this; delete this;
} }
......
...@@ -61,7 +61,7 @@ private: ...@@ -61,7 +61,7 @@ private:
ulong client_capabilities; ulong client_capabilities;
private: private:
/* The main loop implementation triad */ /* The main loop implementation triad */
int init(); bool init();
void main(); void main();
void cleanup(); void cleanup();
......
...@@ -191,7 +191,8 @@ static struct passwd *check_user(const char *user) ...@@ -191,7 +191,8 @@ static struct passwd *check_user(const char *user)
return user_info; return user_info;
err: err:
log_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n", user); log_error("Can not start under user '%s'.",
(const char *) user);
return NULL; return NULL;
} }
......
...@@ -55,7 +55,7 @@ int create_pid_file(const char *pid_file_name, int pid) ...@@ -55,7 +55,7 @@ int create_pid_file(const char *pid_file_name, int pid)
if (!(pid_file= my_fopen(pid_file_name, O_WRONLY | O_CREAT | O_BINARY, if (!(pid_file= my_fopen(pid_file_name, O_WRONLY | O_CREAT | O_BINARY,
MYF(0)))) MYF(0))))
{ {
log_error("Error: can not create pid file '%s': %s (errno: %d)", log_error("Can not create pid file '%s': %s (errno: %d)",
(const char *) pid_file_name, (const char *) pid_file_name,
(const char *) strerror(errno), (const char *) strerror(errno),
(int) errno); (int) errno);
...@@ -64,7 +64,7 @@ int create_pid_file(const char *pid_file_name, int pid) ...@@ -64,7 +64,7 @@ int create_pid_file(const char *pid_file_name, int pid)
if (fprintf(pid_file, "%d\n", (int) pid) <= 0) if (fprintf(pid_file, "%d\n", (int) pid) <= 0)
{ {
log_error("Error: can not write to pid file '%s': %s (errno: %d)", log_error("Can not write to pid file '%s': %s (errno: %d)",
(const char *) pid_file_name, (const char *) pid_file_name,
(const char *) strerror(errno), (const char *) strerror(errno),
(int) errno); (int) errno);
......
...@@ -85,11 +85,11 @@ Thread_registry::~Thread_registry() ...@@ -85,11 +85,11 @@ Thread_registry::~Thread_registry()
void Thread_registry::register_thread(Thread_info *info, void Thread_registry::register_thread(Thread_info *info,
bool send_signal_on_shutdown) bool send_signal_on_shutdown)
{ {
DBUG_PRINT("info", ("Thread_registry: registering thread %d...",
(int) info->thread_id));
info->init(send_signal_on_shutdown); info->init(send_signal_on_shutdown);
DBUG_PRINT("info", ("Thread_registry: registering thread %lu...",
(unsigned long) info->thread_id));
#ifndef __WIN__ #ifndef __WIN__
struct sigaction sa; struct sigaction sa;
sa.sa_handler= handle_signal; sa.sa_handler= handle_signal;
...@@ -116,8 +116,8 @@ void Thread_registry::register_thread(Thread_info *info, ...@@ -116,8 +116,8 @@ void Thread_registry::register_thread(Thread_info *info,
void Thread_registry::unregister_thread(Thread_info *info) void Thread_registry::unregister_thread(Thread_info *info)
{ {
DBUG_PRINT("info", ("Thread_registry: unregistering thread %d...", DBUG_PRINT("info", ("Thread_registry: unregistering thread %lu...",
(int) info->thread_id)); (unsigned long) info->thread_id));
pthread_mutex_lock(&LOCK_thread_registry); pthread_mutex_lock(&LOCK_thread_registry);
info->prev->next= info->next; info->prev->next= info->next;
......
...@@ -41,7 +41,7 @@ int User::init(const char *line) ...@@ -41,7 +41,7 @@ int User::init(const char *line)
name_end= strchr(name_begin, line[0]); name_end= strchr(name_begin, line[0]);
if (name_end == 0 || name_end[1] != ':') if (name_end == 0 || name_end[1] != ':')
{ {
log_info("Error: invalid format (unmatched quote) of user line (%s).", log_error("Invalid format (unmatched quote) of user line (%s).",
(const char *) line); (const char *) line);
return 1; return 1;
} }
...@@ -53,7 +53,7 @@ int User::init(const char *line) ...@@ -53,7 +53,7 @@ int User::init(const char *line)
name_end= strchr(name_begin, ':'); name_end= strchr(name_begin, ':');
if (name_end == 0) if (name_end == 0)
{ {
log_info("Error: invalid format (no delimiter) of user line (%s).", log_error("Invalid format (no delimiter) of user line (%s).",
(const char *) line); (const char *) line);
return 1; return 1;
} }
...@@ -63,7 +63,7 @@ int User::init(const char *line) ...@@ -63,7 +63,7 @@ int User::init(const char *line)
user_length= name_end - name_begin; user_length= name_end - name_begin;
if (user_length > USERNAME_LENGTH) if (user_length > USERNAME_LENGTH)
{ {
log_info("Error: user name is too long (%d). Max length: %d. " log_error("User name is too long (%d). Max length: %d. "
"User line: '%s'.", "User line: '%s'.",
(int) user_length, (int) user_length,
(int) USERNAME_LENGTH, (int) USERNAME_LENGTH,
...@@ -74,7 +74,7 @@ int User::init(const char *line) ...@@ -74,7 +74,7 @@ int User::init(const char *line)
password_length= strlen(password); password_length= strlen(password);
if (password_length > SCRAMBLED_PASSWORD_CHAR_LENGTH) if (password_length > SCRAMBLED_PASSWORD_CHAR_LENGTH)
{ {
log_info("Error: password is too long (%d). Max length: %d." log_error("Password is too long (%d). Max length: %d."
"User line: '%s'.", "User line: '%s'.",
(int) password_length, (int) password_length,
(int) SCRAMBLED_PASSWORD_CHAR_LENGTH, (int) SCRAMBLED_PASSWORD_CHAR_LENGTH,
...@@ -90,7 +90,7 @@ int User::init(const char *line) ...@@ -90,7 +90,7 @@ int User::init(const char *line)
get_salt_from_password(salt, password); get_salt_from_password(salt, password);
log_info("loaded user '%s'.", user); log_info("Loaded user '%s'.", (const char *) user);
return 0; return 0;
} }
...@@ -214,7 +214,7 @@ int User_map::load(const char *password_file_name, const char **err_msg) ...@@ -214,7 +214,7 @@ int User_map::load(const char *password_file_name, const char **err_msg)
return ERR_IO_ERROR; return ERR_IO_ERROR;
} }
log_info("loading the password database..."); log_info("Loading the password database...");
while (fgets(line, sizeof(line), file)) while (fgets(line, sizeof(line), file))
{ {
...@@ -292,7 +292,7 @@ int User_map::load(const char *password_file_name, const char **err_msg) ...@@ -292,7 +292,7 @@ int User_map::load(const char *password_file_name, const char **err_msg)
} }
} }
log_info("the password database loaded successfully."); log_info("The password database loaded successfully.");
my_fclose(file, MYF(0)); my_fclose(file, MYF(0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment