1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

WL #2713 Change IM behaviour so, that it only reads and alters one config file only.

Implemented on brian's request.
This commit is contained in:
petr@mysql.com
2005-07-21 14:21:23 +04:00
parent aa2d5ee550
commit b9fcdfbb0f
9 changed files with 108 additions and 35 deletions

View File

@ -22,6 +22,7 @@
#include "mysql_manager_error.h"
#include "protocol.h"
#include "buffer.h"
#include "options.h"
#include <m_string.h>
#include <mysql.h>
@ -643,6 +644,12 @@ Set_option::Set_option(Instance_map *instance_map_arg,
if ((instance= instance_map->find(name, len)))
{
instance_name= instance->options.instance_name;
if (instance_map->single_defaults_file_option != NULL)
single_defaults_file=
strchr(instance_map->single_defaults_file_option, '=') + 1;
else
single_defaults_file= NULL;
/* add prefix for add_option */
if ((option_len_arg < MAX_OPTION_LEN - 1) ||
(option_value_len_arg < MAX_OPTION_LEN - 1))
@ -689,15 +696,26 @@ int Set_option::correct_file(int skip)
{
int error;
error= modify_defaults_file("/etc/my.cnf", option,
option_value, instance_name, skip);
if (error > 0)
return ER_OUT_OF_RESOURCES;
else if (error < 0)
return ER_ACCESS_OPTION_FILE;
if (single_defaults_file != NULL)
error= modify_defaults_file(single_defaults_file, option,
option_value, instance_name, skip);
else
error= modify_defaults_file(Options::default_config_file, option,
option_value, instance_name, skip);
/* everything was fine */
return 0;
switch (error)
{
case 0:
return 0; /* everything was fine */
case 1:
return ER_OUT_OF_RESOURCES;
case 2:
return ER_ACCESS_OPTION_FILE;
default:
DBUG_ASSERT(0); /* should never get here */
}
return 0; /* keep compiler happy */
}