Fixed error message in createInstance

Fixed error message in createInstance
This commit is contained in:
MassimilianoPinto
2015-08-04 15:47:41 +02:00
parent 28da5f2470
commit 02496d7410
2 changed files with 17 additions and 14 deletions

View File

@ -211,24 +211,27 @@ int rc = 0;
* We only support one server behind this router, since the server is
* the master from which we replicate binlog records. Therefore check
* that only one server has been defined.
*
* A later improvement will be to define multiple servers and have the
* router use the information that is supplied by the monitor to find
* which of these servers is currently the master and replicate from
* that server.
*/
if (service->dbref == NULL || service->dbref->next != NULL)
if (service->dbref != NULL)
{
skygw_log_write(LE,
"%s: Error : Exactly one database server may be "
"for use with the binlog router.",
service->name);
return NULL;
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"%s: Warning: backend database server is provided by master.ini file "
"for use with the binlog router."
" Server section is no longer required.",
service->name)));
server_free(service->dbref->server);
free(service->dbref);
service->dbref = NULL;
}
if ((inst = calloc(1, sizeof(ROUTER_INSTANCE))) == NULL) {
return NULL;
}
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"%s: Error: failed to allocate memory for router instance.",
service->name)));
return NULL;
}
memset(&inst->stats, 0, sizeof(ROUTER_STATS));
memset(&inst->saved_master, 0, sizeof(MASTER_RESPONSES));

View File

@ -1161,7 +1161,7 @@ int n_bufs = -1, pn_bufs = -1;
int msg_len=0;
msg_err = (char *)ptr+7+6; // err msg starts after 7 bytes + 6 of status message
msg_len = len-7-6; // msg len is decreased by 7 and 6
msg_err = (uint8_t *)malloc(msg_len + 1);
msg_err = (char *)malloc(msg_len + 1);
strncpy(msg_err, (char *)ptr+7+6, msg_len);
/* NULL terminate error string */
*(msg_err+msg_len)='\0';