MXS-251: strerror

Replaces all calls to strerror with calls to strerror_r. The former
is non-thread safe while the latter is.
This commit is contained in:
Johan Wikman
2015-09-05 15:32:32 +03:00
parent a9fd7926ac
commit 160bbb70ee
31 changed files with 314 additions and 167 deletions

View File

@ -113,10 +113,11 @@ SHARED_BUF *sbuf;
retblock:
if (rval == 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)))));
}
return rval;
}
@ -182,10 +183,11 @@ GWBUF *rval;
if ((rval = (GWBUF *)calloc(1,sizeof(GWBUF))) == NULL)
{
ss_dassert(rval != 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)))));
return NULL;
}
@ -246,10 +248,11 @@ GWBUF *gwbuf_clone_portion(
if ((clonebuf = (GWBUF *)malloc(sizeof(GWBUF))) == NULL)
{
ss_dassert(clonebuf != 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)))));
return NULL;
}
atomic_add(&buf->sbuf->refcount, 1);
@ -500,10 +503,11 @@ void gwbuf_add_buffer_object(
if (newb == 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)))));
return;
}
newb->bo_id = id;
@ -590,11 +594,11 @@ BUF_PROPERTY *prop;
if ((prop = malloc(sizeof(BUF_PROPERTY))) == NULL)
{
ss_dassert(prop != 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)))));
return 0;
}
prop->name = strdup(name);