Merge remote-tracking branch 'origin/develop' into MXS-329

Conflicts:
	server/core/session.c
This commit is contained in:
counterpoint
2015-09-10 13:07:27 +01:00
69 changed files with 3037 additions and 2062 deletions

View File

@ -277,12 +277,13 @@ char *remote, *userName;
(char *)malloc(strlen(my_instance->filebase) + 20))
== NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"Error : Memory allocation for qla filter "
"file name failed due to %d, %s.",
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(my_session);
return NULL;
}
@ -315,12 +316,13 @@ char *remote, *userName;
if (my_session->fp == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"Error : Opening output file for qla "
"fileter failed due to %d, %s",
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(my_session->filename);
free(my_session);
my_session = NULL;
@ -329,12 +331,13 @@ char *remote, *userName;
}
else
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"Error : Memory allocation for qla filter failed due to "
"%d, %s.",
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
}
return my_session;
}

View File

@ -131,7 +131,8 @@ int open_file(char* str, unsigned int write)
mode = O_RDONLY;
}
if((fd = open(str,mode,S_IRWXU|S_IRGRP|S_IXGRP|S_IXOTH)) < 0){
printf("Error %d: %s\n",errno,strerror(errno));
char errbuf[STRERROR_BUFLEN];
printf("Error %d: %s\n", errno, strerror_r(errno, errbuf, sizeof(errbuf)));
}
return fd;
}

View File

@ -1,6 +1,7 @@
#ifndef _SHARDING_COMMON_HG
#define _SHARDING_COMMON_HG
#include <my_config.h>
#include <poll.h>
#include <buffer.h>
#include <modutil.h>

View File

@ -239,7 +239,7 @@ void mon_append_node_names(MONITOR_SERVERS* start,char* str, int len)
}
first = false;
sprintf(arr,"%s:%d",ptr->server->name,ptr->server->port);
strcat(str,arr);
strncat(str,arr,len);
ptr = ptr->next;
slen = strlen(str);
}
@ -306,10 +306,10 @@ void monitor_launch_script(MONITOR* mon,MONITOR_SERVERS* ptr, char* script)
ptr->server->name,
ptr->server->port);
mon_append_node_names(mon->databases,argstr,PATH_MAX + MON_ARG_MAX + 1);
mon_append_node_names(mon->databases,argstr,PATH_MAX + MON_ARG_MAX);
if((cmd = externcmd_allocate(argstr)) == NULL)
{
skygw_log_write(LE,"Failed to execute script: %s",script);
skygw_log_write(LE,"Failed to initialize script: %s",script);
return;
}

View File

@ -429,7 +429,10 @@ int syseno = 0;
sizeof(one));
if(syseno != 0){
skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno));
char errbuf[STRERROR_BUFLEN];
skygw_log_write_flush(LOGFILE_ERROR,
"Error: Failed to set socket options. Error %d: %s",
errno, strerror_r(errno, errbuf, sizeof(errbuf)));
return 0;
}
/* set NONBLOCKING mode */
@ -448,10 +451,11 @@ int syseno = 0;
} else {
int eno = errno;
errno = 0;
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Failed to start listening http due error %d, %s\n\n",
eno,
strerror(eno));
strerror_r(eno, errbuf, sizeof(errbuf)));
return 0;
}

View File

@ -380,12 +380,13 @@ int rc;
} else {
int eno = errno;
errno = 0;
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"Failed to start listening for maxscale admin connections "
"due error %d, %s\n\n",
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
return 0;
}

View File

@ -32,7 +32,7 @@
* 17/06/2013 Massimiliano Pinto Added MaxScale To Backends routines
* 01/07/2013 Massimiliano Pinto Put Log Manager example code behind SS_DEBUG macros.
* 03/07/2013 Massimiliano Pinto Added delayq for incoming data before mysql connection
* 04/07/2013 Massimiliano Pinto Added asyncrhronous MySQL protocol connection to backend
* 04/07/2013 Massimiliano Pinto Added asynchronous MySQL protocol connection to backend
* 05/07/2013 Massimiliano Pinto Added closeSession if backend auth fails
* 12/07/2013 Massimiliano Pinto Added Mysql Change User via dcb->func.auth()
* 15/07/2013 Massimiliano Pinto Added Mysql session change via dcb->func.session()
@ -548,6 +548,18 @@ static int gw_read_backend_event(DCB *dcb) {
rc = 0;
goto return_rc;
}
if (!read_buffer) {
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"%lu [gw_read_backend_event] "
"Read buffer unexpectedly null, even though response "
"not marked as complete. User: %s",
pthread_self(),
current_session->user)));
rc = 0;
goto return_rc;
}
}
/**
* Check that session is operable, and that client DCB is
@ -825,7 +837,6 @@ static int gw_error_backend_event(DCB *dcb)
if (dcb->state != DCB_STATE_POLLING)
{
int error, len;
char buf[100];
len = sizeof(error);
@ -833,12 +844,12 @@ static int gw_error_backend_event(DCB *dcb)
{
if (error != 0)
{
strerror_r(error, buf, 100);
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"DCB in state %s got error '%s'.",
STRDCBSTATE(dcb->state),
buf)));
strerror_r(error, errbuf, sizeof(errbuf)))));
}
}
return 1;
@ -868,18 +879,17 @@ static int gw_error_backend_event(DCB *dcb)
if (ses_state != SESSION_STATE_ROUTER_READY)
{
int error, len;
char buf[100];
len = sizeof(error);
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, (socklen_t *)&len) == 0)
{
if (error != 0)
{
strerror_r(error, buf, 100);
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error '%s' in session that is not ready for routing.",
buf)));
strerror_r(error, errbuf, sizeof(errbuf)))));
}
}
gwbuf_free(errbuf);
@ -1092,19 +1102,18 @@ gw_backend_hangup(DCB *dcb)
if (ses_state != SESSION_STATE_ROUTER_READY)
{
int error, len;
char buf[100];
len = sizeof(error);
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, (socklen_t *)&len) == 0)
{
if (error != 0 && ses_state != SESSION_STATE_STOPPING)
{
strerror_r(error, buf, 100);
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Hangup in session that is not ready for routing, "
"Error reported is '%s'.",
buf)));
strerror_r(error, errbuf, sizeof(errbuf)))));
}
}
gwbuf_free(errbuf);
@ -1556,9 +1565,10 @@ static GWBUF* process_response_data (
* enough data to read the packet length.
*/
init_response_status(readbuf, srvcmd, &npackets_left, &nbytes_left);
initial_packets = npackets_left;
initial_bytes = nbytes_left;
}
initial_packets = npackets_left;
initial_bytes = nbytes_left;
}
/** Only session commands with responses should be processed */
ss_dassert(npackets_left > 0);

View File

@ -1355,11 +1355,12 @@ int gw_MySQLListener(
// UNIX socket create
if ((l_so = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Error: can't create UNIX socket due "
"error %i, %s.\n\n\t",
errno,
strerror(errno));
strerror_r(errno, errbuf, sizeof(errbuf)));
return 0;
}
memset(&local_addr, 0, sizeof(local_addr));
@ -1376,11 +1377,12 @@ int gw_MySQLListener(
}
// TCP socket create
if ((l_so = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Error: can't create socket due "
"error %i, %s.\n\n\t",
errno,
strerror(errno));
strerror_r(errno, errbuf, sizeof(errbuf)));
return 0;
}
@ -1392,13 +1394,15 @@ int gw_MySQLListener(
// socket options
if((syseno = setsockopt(l_so, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one))) != 0){
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno))));
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s", errno, strerror_r(errno, errbuf, sizeof(errbuf)))));
}
if(is_tcp)
{
char errbuf[STRERROR_BUFLEN];
if((syseno = setsockopt(l_so, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one))) != 0){
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno))));
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s", errno, strerror_r(errno, errbuf, sizeof(errbuf)))));
}
}
// set NONBLOCKING mode
@ -1413,10 +1417,11 @@ int gw_MySQLListener(
}
if (bind(l_so, (struct sockaddr *) &local_addr, sizeof(local_addr)) < 0) {
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Bind failed due error %i, %s.\n",
errno,
strerror(errno));
strerror_r(errno, errbuf, sizeof(errbuf)));
fprintf(stderr, "* Can't bind to %s\n\n", config_bind);
close(l_so);
return 0;
@ -1424,21 +1429,23 @@ int gw_MySQLListener(
/* set permission for all users */
if (chmod(config_bind, 0777) < 0) {
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* chmod failed for %s due error %i, %s.\n\n",
config_bind,
errno,
strerror(errno));
strerror_r(errno, errbuf, sizeof(errbuf)));
}
break;
case AF_INET:
if (bind(l_so, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Bind failed due error %i, %s.\n",
errno,
strerror(errno));
strerror_r(errno, errbuf, sizeof(errbuf)));
fprintf(stderr, "* Can't bind to %s\n\n", config_bind);
close(l_so);
return 0;
@ -1458,10 +1465,11 @@ int gw_MySQLListener(
} else {
int eno = errno;
errno = 0;
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Failed to start listening MySQL due error %d, %s\n\n",
eno,
strerror(eno));
strerror_r(eno, errbuf, sizeof(errbuf)));
close(l_so);
return 0;
}
@ -1554,22 +1562,24 @@ int gw_MySQLAccept(DCB *listener)
* Exceeded system's (ENFILE) or processes
* (EMFILE) max. number of files limit.
*/
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [gw_MySQLAccept] Error %d, %s. ",
pthread_self(),
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
if (i == 0)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error %d, %s. "
"Failed to accept new client "
"connection.",
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
}
i++;
ts1.tv_nsec = 100*i*i*1000000;
@ -1586,18 +1596,19 @@ int gw_MySQLAccept(DCB *listener)
/**
* Other error.
*/
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [gw_MySQLAccept] Error %d, %s.",
pthread_self(),
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Failed to accept new client "
"connection due to %d, %s.",
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
rc = 1;
goto return_rc;
} /* if (eno == ..) */
@ -1618,15 +1629,16 @@ int gw_MySQLAccept(DCB *listener)
#endif /* FAKE_CODE */
/* set nonblocking */
sendbuf = GW_CLIENT_SO_SNDBUF;
char errbuf[STRERROR_BUFLEN];
if((syseno = setsockopt(c_sock, SOL_SOCKET, SO_SNDBUF, &sendbuf, optlen)) != 0){
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno))));
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s", errno, strerror_r(errno, errbuf, sizeof(errbuf)))));
}
sendbuf = GW_CLIENT_SO_RCVBUF;
if((syseno = setsockopt(c_sock, SOL_SOCKET, SO_RCVBUF, &sendbuf, optlen)) != 0){
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno))));
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s", errno, strerror_r(errno, errbuf, sizeof(errbuf)))));
}
setnonblocking(c_sock);

View File

@ -90,13 +90,14 @@ MySQLProtocol* mysql_protocol_init(
if (p == NULL) {
int eno = errno;
errno = 0;
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"%lu [mysql_init_protocol] MySQL protocol init failed : "
"memory allocation due error %d, %s.",
pthread_self(),
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
goto return_p;
}
p->protocol_state = MYSQL_PROTOCOL_ALLOC;
@ -731,8 +732,8 @@ int gw_send_authentication_to_backend(
rv = dcb_write(dcb, buffer);
if (rv < 0) {
return rv;
if (rv == 0) {
return 1;
} else {
return 0;
}
@ -767,6 +768,7 @@ int gw_do_connect_to_backend(
so = socket(AF_INET,SOCK_STREAM,0);
if (so < 0) {
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Establishing connection to backend server "
@ -775,7 +777,7 @@ int gw_do_connect_to_backend(
host,
port,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
rv = -1;
goto return_rv;
}
@ -786,6 +788,7 @@ int gw_do_connect_to_backend(
if(setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)) != 0)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Failed to set socket options "
@ -794,7 +797,7 @@ int gw_do_connect_to_backend(
host,
port,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
rv = -1;
/** Close socket */
goto close_so;
@ -803,6 +806,7 @@ int gw_do_connect_to_backend(
if(setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)) != 0)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Failed to set socket options "
@ -811,7 +815,7 @@ int gw_do_connect_to_backend(
host,
port,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
rv = -1;
/** Close socket */
goto close_so;
@ -820,6 +824,7 @@ int gw_do_connect_to_backend(
int one = 1;
if(setsockopt(so, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) != 0)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Failed to set socket options "
@ -828,7 +833,7 @@ int gw_do_connect_to_backend(
host,
port,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
rv = -1;
/** Close socket */
goto close_so;
@ -846,6 +851,7 @@ int gw_do_connect_to_backend(
}
else
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Failed to connect backend server %s:%d, "
@ -853,7 +859,7 @@ int gw_do_connect_to_backend(
host,
port,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
/** Close socket */
goto close_so;
}
@ -878,13 +884,14 @@ close_so:
/*< Close newly created socket. */
if (close(so) != 0)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error: Failed to "
"close socket %d due %d, %s.",
so,
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
}
goto return_rv;
}
@ -2240,10 +2247,11 @@ char *create_auth_fail_str(
if (errstr == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Memory allocation failed due to %s.",
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
goto retblock;
}

View File

@ -386,7 +386,8 @@ int syseno = 0;
syseno = setsockopt(listener->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one));
if(syseno != 0){
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s",errno,strerror(errno))));
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error: Failed to set socket options. Error %d: %s", errno, strerror_r(errno, errbuf, sizeof(errbuf)))));
return 0;
}
// set NONBLOCKING mode
@ -404,10 +405,11 @@ int syseno = 0;
} else {
int eno = errno;
errno = 0;
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"\n* Failed to start listening telnet due error %d, %s\n\n",
eno,
strerror(eno));
strerror_r(eno, errbuf, sizeof(errbuf)));
return 0;
}

View File

@ -854,7 +854,8 @@ struct tm tm;
if (router_inst->lastEventTimestamp)
{
localtime_r((const time_t*)&router_inst->lastEventTimestamp, &tm);
time_t last_event = (time_t)router_inst->lastEventTimestamp;
localtime_r(&last_event, &tm);
asctime_r(&tm, buf);
dcb_printf(dcb, "\tLast binlog event timestamp: %ld (%s)\n",
router_inst->lastEventTimestamp, buf);
@ -982,7 +983,8 @@ struct tm tm;
if (session->lastEventTimestamp
&& router_inst->lastEventTimestamp)
{
localtime_r((const time_t*)&session->lastEventTimestamp, &tm);
time_t session_last_event = (time_t)session->lastEventTimestamp;
localtime_r(&session_last_event, &tm);
asctime_r(&tm, buf);
dcb_printf(dcb, "\t\tLast binlog event timestamp %u, %s", session->lastEventTimestamp, buf);
dcb_printf(dcb, "\t\tSeconds behind master %u\n", router_inst->lastEventTimestamp - session->lastEventTimestamp);
@ -1082,7 +1084,7 @@ errorReply(ROUTER *instance, void *router_session, GWBUF *message, DCB *backend_
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)instance;
int error;
socklen_t len;
char msg[85], *errmsg;
char msg[STRERROR_BUFLEN + 1], *errmsg;
/** Don't handle same error twice on same DCB */
if (backend_dcb->dcb_errhandle_called)
@ -1099,8 +1101,8 @@ char msg[85], *errmsg;
len = sizeof(error);
if (router->master && getsockopt(router->master->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0 && error != 0)
{
strerror_r(error, msg, 80);
strcat(msg, " ");
char errbuf[STRERROR_BUFLEN];
sprintf(msg, "%s ", strerror_r(error, errbuf, sizeof(errbuf)));
}
else
strcpy(msg, "");

View File

@ -950,7 +950,7 @@ int n_bufs = -1, pn_bufs = -1;
return;
}
}
router->stats.n_binlogs++;
router->lastEventReceived = hdr.event_type;
router->lastEventTimestamp = hdr.timestamp;

View File

@ -1464,7 +1464,7 @@ static void fail_accept(
{
int failcount = MIN(atoi(arg2), 100);
fail_accept_errno = atoi(arg1);
char errbuf[STRERROR_BUFLEN];
switch(fail_accept_errno) {
case EAGAIN:
@ -1486,7 +1486,7 @@ static void fail_accept(
dcb_printf(dcb,
"[%d, %s] is not valid errno for accept.\n",
fail_accept_errno,
strerror(fail_accept_errno));
strerror_r(fail_accept_errno, errbuf, sizeof(errbuf)));
return ;
}
}

View File

@ -1443,7 +1443,8 @@ static route_target_t get_route_target (
{
target = TARGET_SLAVE;
}
else if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) ||
/** Configured not to allow reading variables from slaves */
(use_sql_variables_in == TYPE_MASTER &&
@ -2587,8 +2588,8 @@ static bool route_single_stmt(
rses_end_locked_router_action(rses);
goto retblock;
}
GWBUF* wbuf = gwbuf_clone(querybuf);
if ((ret = target_dcb->func.write(target_dcb, wbuf)) == 1)
if ((ret = target_dcb->func.write(target_dcb, gwbuf_clone(querybuf))) == 1)
{
backend_ref_t* bref;
@ -2602,7 +2603,6 @@ static bool route_single_stmt(
}
else
{
gwbuf_free(wbuf);
LOGIF((LE|LT), (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Routing query failed.")));

View File

@ -610,9 +610,11 @@ char** tokenize_string(char* str)
char** tmp = realloc(list,sizeof(char*)*(sz*2));
if(tmp == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.",strerror(errno))));
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.",
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(list);
return NULL;
}

View File

@ -567,9 +567,11 @@ tokenize_string(char* str)
char** tmp = realloc(list, sizeof(char*)*(sz * 2));
if(tmp == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.", strerror(errno))));
"Error : realloc returned NULL: %s.",
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(list);
return NULL;
}