Added #include <strings.h> and length indicator to strncasecmp call.
Fix to bug #513, http://bugs.mariadb.com/show_bug.cgi?id=513
Replaced usleep with nanosleep.
This commit is contained in:
VilhoRaatikka 2014-10-09 15:51:46 +03:00
parent 659f3bfd58
commit 2bd93025a9

View File

@ -42,8 +42,10 @@
#define _XOPEN_SOURCE 700
#include <ftw.h>
#include <string.h>
#include <strings.h>
#include <gw.h>
#include <unistd.h>
#include <time.h>
#include <getopt.h>
#include <service.h>
#include <server.h>
@ -226,7 +228,6 @@ sigfatal_handler (int i)
{
void *addrs[128];
char **strings= NULL;
int n, count = backtrace(addrs, 128);
char** symbols = backtrace_symbols( addrs, count );
@ -1088,9 +1089,9 @@ int main(int argc, char **argv)
goto return_main;
case 'l':
if (strncasecmp(optarg, "file") == 0)
if (strncasecmp(optarg, "file", PATH_MAX) == 0)
logtofile = 1;
else if (strncasecmp(optarg, "shm") == 0)
else if (strncasecmp(optarg, "shm", PATH_MAX) == 0)
logtofile = 0;
else
{
@ -1669,6 +1670,8 @@ static void log_flush_cb(
void* arg)
{
ssize_t timeout_ms = *(ssize_t *)arg;
const struct timespec ts1 = {0, 1000000*timeout_ms};
struct timespec ts2;
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"Started MaxScale log flusher.")));
@ -1677,7 +1680,7 @@ static void log_flush_cb(
skygw_log_flush(LOGFILE_MESSAGE);
skygw_log_flush(LOGFILE_TRACE);
skygw_log_flush(LOGFILE_DEBUG);
usleep(timeout_ms*1000);
nanosleep(&ts1, &ts2);
}
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"Finished MaxScale log flusher.")));