diff --git a/src/audit_handler.cc b/src/audit_handler.cc index aef2499..ccadc27 100644 --- a/src/audit_handler.cc +++ b/src/audit_handler.cc @@ -215,6 +215,16 @@ int Audit_file_handler::open(const char * io_dest, bool log_errors) //no locks. called by handler_start and when it is time to retry bool Audit_io_handler::handler_start_internal() { + if(!m_io_dest || strlen(m_io_dest) == 0) + { + if(m_log_io_errors) + { + sql_print_error( + "%s %s: io destination not set. Not connecting.", + AUDIT_LOG_PREFIX, m_io_type); + } + return false; + } if (open(m_io_dest, m_log_io_errors) != 0) { //open failed @@ -319,7 +329,7 @@ ssize_t Audit_socket_handler::write(const char * data, size_t size) } int Audit_socket_handler::open(const char * io_dest, bool log_errors) -{ +{ //open the socket int sock = socket(AF_UNIX,SOCK_STREAM,0); if (sock < 0) diff --git a/src/audit_plugin.cc b/src/audit_plugin.cc index 5359d3b..95ae36a 100644 --- a/src/audit_plugin.cc +++ b/src/audit_plugin.cc @@ -1223,7 +1223,7 @@ static void json_socket_name_update(THD *thd, struct st_mysql_sys_var *var, void { strncpy( json_socket_name_buff , str, buff_len); } - if(strlen(json_socket_name_buff) == 0) //set default + if(strlen(json_socket_name_buff) == 0 && (mysqld_port > 0 || mysqld_unix_port)) //set default { const char * name_prefix = "/tmp/mysql.audit_";