Merge remote-tracking branch 'origin/develop' into MXS-472a

This commit is contained in:
counterpoint
2015-11-23 10:05:55 +00:00
33 changed files with 4047 additions and 3975 deletions

View File

@ -5,7 +5,7 @@ if(BUILD_TESTS OR BUILD_TOOLS)
elseif(WITH_TCMALLOC)
target_link_libraries(fullcore ${TCMALLOC_LIBRARIES})
endif()
target_link_libraries(fullcore ${CURL_LIBRARIES} utils log_manager pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++)
target_link_libraries(fullcore ${CURL_LIBRARIES} utils log_manager pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++)
add_dependencies(fullcore pcre2)
endif()
@ -22,7 +22,7 @@ elseif(WITH_TCMALLOC)
target_link_libraries(maxscale ${TCMALLOC_LIBRARIES})
endif()
target_link_libraries(maxscale ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
target_link_libraries(maxscale ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR})
add_executable(maxkeys maxkeys.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)

View File

@ -146,7 +146,7 @@ char* config_clean_string_list(char* str)
int re_err;
size_t err_offset;
if ((re = pcre2_compile((PCRE2_SPTR) "[[:space:],]*([^,]+)\\b[[:space:],]*", PCRE2_ZERO_TERMINATED, 0,
if ((re = pcre2_compile((PCRE2_SPTR) "[[:space:],]*([^,]*[^[:space:],])[[:space:],]*", PCRE2_ZERO_TERMINATED, 0,
&re_err, &err_offset, NULL)) == NULL ||
(data = pcre2_match_data_create_from_pattern(re, NULL)) == NULL)
{
@ -279,6 +279,7 @@ handler(void *userdata, const char *section, const char *name, const char *value
param->name = strdup(name);
param->value = strdup(value);
param->next = ptr->parameters;
param->qfd_param_type = UNDEFINED_TYPE;
ptr->parameters = param;
return 1;

View File

@ -1986,9 +1986,9 @@ dprintOneDCB(DCB *pdcb, DCB *dcb)
if (dcb->persistentstart)
{
char buff[20];
struct tm * timeinfo;
timeinfo = localtime (&dcb->persistentstart);
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", timeinfo);
struct tm timeinfo;
localtime_r(&dcb->persistentstart, &timeinfo);
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", &timeinfo);
dcb_printf(pdcb, "\t\tAdded to persistent pool: %s\n", buff);
}
}
@ -2160,9 +2160,9 @@ dprintDCB(DCB *pdcb, DCB *dcb)
if (dcb->persistentstart)
{
char buff[20];
struct tm * timeinfo;
timeinfo = localtime (&dcb->persistentstart);
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", timeinfo);
struct tm timeinfo;
localtime_r(&dcb->persistentstart, &timeinfo);
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", &timeinfo);
dcb_printf(pdcb, "\t\tAdded to persistent pool: %s\n", buff);
}
}

View File

@ -516,6 +516,8 @@ static bool file_write_footer(
return succp;
}
// Documentation says 26 bytes is enough, but 32 is a nice round number.
#define ASCTIME_BUF_LEN 32
static bool file_write_header(
FILE* outfile)
{
@ -524,10 +526,10 @@ static bool file_write_header(
size_t len2;
size_t len3;
const char* header_buf1;
char* header_buf2 = NULL;
char header_buf2[ASCTIME_BUF_LEN];
const char* header_buf3;
time_t* t = NULL;
struct tm* tm = NULL;
time_t t;
struct tm tm;
#if defined(LAPTOP_TEST)
struct timespec ts1;
ts1.tv_sec = 0;
@ -538,23 +540,10 @@ static bool file_write_header(
return true;
#endif
if ((t = (time_t *)malloc(sizeof(time_t))) == NULL) {
goto return_succp;
}
if ((tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) {
goto return_succp;
}
*t = time(NULL);
*tm = *localtime(t);
localtime_r(&t, &tm);
header_buf1 = "\n\nMariaDB Corporation MaxScale " MAXSCALE_VERSION "\t";
header_buf2 = strdup(asctime(tm));
if (header_buf2 == NULL) {
goto return_succp;
}
asctime_r(&tm, header_buf2);
header_buf3 = "------------------------------------------------------\n";
len1 = strlen(header_buf1);
@ -570,16 +559,6 @@ static bool file_write_header(
succp = true;
return_succp:
if (tm != NULL) {
free(tm);
}
if (t != NULL) {
free(t);
}
if (header_buf2 != NULL) {
free(header_buf2);
}
return succp;
}
@ -1828,10 +1807,11 @@ int main(int argc, char **argv)
if (!config_load(cnf_file_path))
{
char* fprerr = "Failed to load MaxScale configuration "
char* fprerr =
"Failed to open, read or process the MaxScale configuration "
"file. Exiting. See the error log for details.";
print_log_n_stderr(false, !daemon_mode, fprerr, fprerr, 0);
MXS_ERROR("Failed to load MaxScale configuration file %s. "
MXS_ERROR("Failed to open, read or process the MaxScale configuration file %s. "
"Exiting.",
cnf_file_path);
rc = MAXSCALE_BADCONFIG;

View File

@ -530,7 +530,8 @@ module_feedback_send(void* data) {
int http_send = 0;
now = time(NULL);
now_tm = localtime(&now);
struct tm now_result;
now_tm = localtime_r(&now, &now_result);
hour = now_tm->tm_hour;
FEEDBACK_CONF *feedback_config = (FEEDBACK_CONF *) data;

View File

@ -1113,7 +1113,7 @@ serviceSetFilters(SERVICE *service, char *filters)
}
else
{
MXS_WARNING("Unable to find filter '%s' for service '%s'\n",
MXS_ERROR("Unable to find filter '%s' for service '%s'\n",
filter_name, service->name);
rval = false;
break;

View File

@ -59,7 +59,7 @@ int result, count;
"testusers : Initialise the user table.");
users = users_alloc();
mxs_log_flush_sync();
ss_info_dassert(NULL != users, "Allocating user table should not return NULL.")
ss_info_dassert(NULL != users, "Allocating user table should not return NULL.");
ss_dfprintf(stderr, "\t..done\nAdd a user");
count = users_add(users, "username", "authorisation");
mxs_log_flush_sync();