diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-05-04 23:32:45 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-05-07 18:40:36 +0200 |
commit | 88961a28e2694db18acb6d355089e52ac2b9a769 (patch) | |
tree | 237eba3cc014ce043d69340dd735a90193a70467 /sql | |
parent | 15c79c41e435758392a1474fccf45978fec1e45c (diff) | |
download | mariadb-git-88961a28e2694db18acb6d355089e52ac2b9a769.tar.gz |
MDEV-17710 "unknown error" with FLUSH LOGS if log directory is not writeable
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 12 | ||||
-rw-r--r-- | sql/log.h | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/sql_reload.cc | 7 |
4 files changed, 7 insertions, 16 deletions
diff --git a/sql/log.cc b/sql/log.cc index ac885746c62..819ece8f98f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8644,14 +8644,14 @@ void sql_perror(const char *message) redirect stdout and stderr to a file. The streams are reopened only for appending (writing at end of file). */ -extern "C" my_bool reopen_fstreams(const char *filename, - FILE *outstream, FILE *errstream) +bool reopen_fstreams(const char *filename, FILE *outstream, FILE *errstream) { - if (outstream && !my_freopen(filename, "a", outstream)) - return TRUE; - - if (errstream && !my_freopen(filename, "a", errstream)) + if ((outstream && !my_freopen(filename, "a", outstream)) || + (errstream && !my_freopen(filename, "a", errstream))) + { + my_error(ER_CANT_CREATE_FILE, MYF(0), filename, errno); return TRUE; + } /* The error stream must be unbuffered. */ if (errstream) diff --git a/sql/log.h b/sql/log.h index 7dfdb36c442..91a7dcd80ab 100644 --- a/sql/log.h +++ b/sql/log.h @@ -26,6 +26,7 @@ class Relay_log_info; class Format_description_log_event; +bool reopen_fstreams(const char *filename, FILE *outstream, FILE *errstream); void setup_log_handling(); bool trans_has_updated_trans_table(const THD* thd); bool stmt_has_updated_trans_table(const THD *thd); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1c948f4563f..a824d0898d6 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -209,9 +209,6 @@ typedef fp_except fp_except_t; #define fcntl(X,Y,Z) 0 #endif -extern "C" my_bool reopen_fstreams(const char *filename, - FILE *outstream, FILE *errstream); - inline void setup_fpu() { #if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index abdf9d76d15..bb8b5e94173 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -124,14 +124,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, if (options & REFRESH_ERROR_LOG) if (unlikely(flush_error_log())) - { - /* - When flush_error_log() failed, my_error() has not been called. - So, we have to do it here to keep the protocol. - */ - my_error(ER_UNKNOWN_ERROR, MYF(0)); result= 1; - } if ((options & REFRESH_SLOW_LOG) && global_system_variables.sql_log_slow) logger.flush_slow_log(); |