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

@ -909,6 +909,7 @@ unsigned long qtime;
&tls_log_info.li_enabled_logs)));
dcb->func.write_ready(dcb);
} else {
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [poll_waitevents] "
@ -916,7 +917,7 @@ unsigned long qtime;
"dcb %p, fd %i",
pthread_self(),
eno,
strerror(eno),
strerror_r(eno, errbuf, sizeof(errbuf)),
dcb,
dcb->fd)));
}
@ -963,6 +964,7 @@ unsigned long qtime;
#if defined(FAKE_CODE)
if (eno == 0) {
eno = dcb_fake_write_errno[dcb->fd];
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [poll_waitevents] "
@ -970,18 +972,19 @@ unsigned long qtime;
"%s",
pthread_self(),
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
}
dcb_fake_write_errno[dcb->fd] = 0;
#endif /* FAKE_CODE */
if (eno != 0) {
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [poll_waitevents] "
"EPOLLERR due %d, %s.",
pthread_self(),
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
}
atomic_add(&pollStats.n_error, 1);
/** Read session id to thread's local storage */
@ -996,7 +999,7 @@ unsigned long qtime;
{
int eno = 0;
eno = gw_getsockerrno(dcb->fd);
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [poll_waitevents] "
@ -1006,7 +1009,7 @@ unsigned long qtime;
dcb,
dcb->fd,
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
atomic_add(&pollStats.n_hup, 1);
spinlock_acquire(&dcb->dcb_initlock);
if ((dcb->flags & DCBF_HUNG) == 0)
@ -1029,7 +1032,7 @@ unsigned long qtime;
{
int eno = 0;
eno = gw_getsockerrno(dcb->fd);
char errbuf[STRERROR_BUFLEN];
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [poll_waitevents] "
@ -1039,7 +1042,7 @@ unsigned long qtime;
dcb,
dcb->fd,
eno,
strerror(eno))));
strerror_r(eno, errbuf, sizeof(errbuf)))));
atomic_add(&pollStats.n_hup, 1);
spinlock_acquire(&dcb->dcb_initlock);
if ((dcb->flags & DCBF_HUNG) == 0)