Commit 73ec339d authored by unknown's avatar unknown

Fix for bug #12177 (error file isn't closed)


libmysqld/lib_sql.cc:
  now errorlog is closed during mysql_server_end
parent 90e41fac
...@@ -321,6 +321,7 @@ extern "C" ...@@ -321,6 +321,7 @@ extern "C"
static my_bool org_my_init_done; static my_bool org_my_init_done;
my_bool server_inited; my_bool server_inited;
char ** copy_arguments_ptr= 0; char ** copy_arguments_ptr= 0;
static FILE *errorlog_file=0;
int STDCALL mysql_server_init(int argc, char **argv, char **groups) int STDCALL mysql_server_init(int argc, char **argv, char **groups)
{ {
...@@ -421,7 +422,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) ...@@ -421,7 +422,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
opt_error_log= 1; // Too long file name opt_error_log= 1; // Too long file name
else else
{ {
freopen(log_error_file, "a+", stderr); errorlog_file= freopen(log_error_file, "a+", stderr);
} }
} }
...@@ -626,6 +627,8 @@ void STDCALL mysql_server_end() ...@@ -626,6 +627,8 @@ void STDCALL mysql_server_end()
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0; copy_arguments_ptr=0;
clean_up(0); clean_up(0);
if (errorlog_file)
fclose(errorlog_file);
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
my_end(0); my_end(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