From c05d43100b4476a1145d3042ddb61fe792175500 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 24 Apr 2015 21:03:43 +0200 Subject: [PATCH] bug: crash when sync() or close() of a log file fails on shutdown because current_thd is NULL and ER() causes sigsegv --- sql/log.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index f495d28daa7..e43a83962e1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2491,14 +2491,14 @@ void MYSQL_LOG::close(uint exiting) if (mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error) { write_error= 1; - sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno); + sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno); } if (!(exiting & LOG_CLOSE_DELAYED_CLOSE) && mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error) { write_error= 1; - sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno); + sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno); } }