Commit 9c9d10b4 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-9106 Audit plugin not working with MySQL 5.7.

        fixing Windows crash.
parent fe4823d2
......@@ -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;
......
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