← Back to team overview

maria-developers team mailing list archive

Re: MDEV-4472 Audit-plugin. Server-related part of the task

 

Hi, Holyfoot!

On Sep 05, holyfoot@xxxxxxxxxxxx wrote:
> At file:///home/hf/wmar/55-4472/
> 
> === renamed file 'plugin/sql_errlog/sql_logger.cc' => 'mysys/file_logger.c'
> --- a/plugin/sql_errlog/sql_logger.cc	2013-06-22 12:02:03 +0000
> +++ b/mysys/file_logger.c	2013-09-05 12:47:00 +0000
> @@ -16,10 +16,12 @@
>  
>  #include "my_global.h"
>  #include <my_sys.h>
> -#include "service_logger.h"
> +#include <mysql/service_logger.h>
>  #include <my_pthread.h>
>  
> +#ifndef _WIN32
>  extern MYSQL_PLUGIN_IMPORT char  *mysql_data_home;
> +#endif /*!_WIN32*/
>  
>  #ifdef HAVE_PSI_INTERFACE
>  /* These belong to the service initialization */
> @@ -51,6 +53,12 @@ LOGGER_HANDLE *logger_open(const char *p
>                             unsigned int rotations)
>  {
>    LOGGER_HANDLE new_log, *l_perm;
> +  //char *local_mysql_data_home;
> +//#ifdef _WIN32
> +  //local_mysql_data_home= (char *)GetProcAddress(0, "mysql_data_home");
> +//#else
> +  //local_mysql_data_home= mysql_data_home;
> +//#endif /*_WIN32*/

I think you can completely remove this and the #ifndef above.
For your MySQL plugin you can simply #include this in the plugin body
like

  extern char  *mysql_data_home;
  #include "file_logger.c"

and later in your plugin_init function:

   #ifdef _WIN32
     mysql_data_home= (char *)GetProcAddress(0, "mysql_data_home");
   #endif

This way you will keep file_logger.c completely free of the dynamic
plugin hacks.

>    /*
>      I don't think we ever need more rotations,
> @@ -168,6 +176,29 @@ int logger_vprintf(LOGGER_HANDLE *log, c
>  int logger_rotate(LOGGER_HANDLE *log)
>  {
>    int result;

I believe you've added recently a test to disable rotation if number of
rotations is 0?

Regards,
Sergei


Follow ups