diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2016-01-15 09:50:27 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2016-01-15 09:50:27 +0400 |
commit | 9c9d10b441fe79b111509949ca40afe1a6284c0f (patch) | |
tree | 711987da57b2db41b16f1a1a1093a99bb7bab86c /plugin | |
parent | fe4823d28e1fdd5f76ddf9b6d63b3108d9763cef (diff) | |
download | mariadb-git-9c9d10b441fe79b111509949ca40afe1a6284c0f.tar.gz |
MDEV-9106 Audit plugin not working with MySQL 5.7.
fixing Windows crash.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/server_audit/server_audit.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 00958007ff6..d988f7e8317 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -116,18 +116,41 @@ static char *default_home= (char *)"."; #define FLOGGER_SKIP_INCLUDES #define my_open(A, B, C) loc_open(A, B) -#define my_close(A, B) close(A) +#define my_close(A, B) loc_close(A) #define my_rename(A, B, C) loc_rename(A, B) #define my_tell(A, B) loc_tell(A) -#define my_write(A, B, C, D) write(A, B, C) +#define my_write(A, B, C, D) loc_write(A, B, C) #define my_malloc(A, B) malloc(A) #define my_free(A) free(A) +#ifdef my_errno + #undef my_errno +#endif +static int loc_file_errno; +#define my_errno loc_file_errno #ifdef my_vsnprintf #undef my_vsnprintf #endif #define my_vsnprintf vsnprintf +#define logger_open loc_logger_open +#define logger_close loc_logger_close +#define logger_write loc_logger_write +#define logger_rotate loc_logger_rotate +#define logger_init_mutexts loc_logger_init_mutexts + + +static size_t loc_write(File Filedes, const uchar *Buffer, size_t Count) +{ + size_t writtenbytes; +#ifdef _WIN32 + writtenbytes= my_win_write(Filedes, Buffer, Count); +#else + writtenbytes= write(Filedes, Buffer, Count); +#endif + return writtenbytes; +} + -File loc_open(const char *FileName, int Flags) +static File loc_open(const char *FileName, int Flags) /* Path-name of file */ /* Read | write .. */ /* Special flags */ @@ -140,9 +163,27 @@ File loc_open(const char *FileName, int Flags) #else fd = open((char *) FileName, Flags); #endif + my_errno= errno; return fd; } + +static int loc_close(File fd) +{ + int err; +#ifndef _WIN32 + do + { + err= close(fd); + } while (err == -1 && errno == EINTR); +#else + err= my_win_close(fd); +#endif + my_errno=errno; + return err; +} + + static int loc_rename(const char *from, const char *to) { int error = 0; |