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

@ -907,12 +907,13 @@ getAllUsers(SERVICE *service, USERS *users)
users_data = (char *)calloc(nusers, (users_data_row_len * sizeof(char)) + 1);
if (users_data == NULL) {
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Memory allocation for user data failed due to "
"Error : Memory allocation for user data failed due to "
"%d, %s.",
errno,
strerror(errno))));
errno,
strerror_r(errno, errbuf, sizeof(errbuf)))));
mysql_free_result(result);
mysql_close(con);
@ -1416,12 +1417,13 @@ getUsers(SERVICE *service, USERS *users)
users_data = (char *)calloc(nusers, (users_data_row_len * sizeof(char)) + 1);
if (users_data == NULL) {
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Memory allocation for user data failed due to "
"%d, %s.",
errno,
strerror(errno))));
strerror_r(errno, errbuf, sizeof(errbuf)))));
mysql_free_result(result);
mysql_close(con);
@ -2471,4 +2473,4 @@ bool check_service_permissions(SERVICE* service)
mysql_close(mysql);
free(dpasswd);
return rval;
}
}