Fixed snprint_timestamp function which left one byte garbage to log file.

This commit is contained in:
vraatikka
2013-11-12 17:49:28 +02:00
parent 836c7ad76d
commit 1a3fa578da
2 changed files with 5 additions and 5 deletions

View File

@ -123,8 +123,8 @@ GWPROTOCOL *funcs;
port->listener = NULL; port->listener = NULL;
skygw_log_write_flush( skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"Error : Unable to load protocol module %s. Listener for " "Error : Unable to load protocol module %s. Listener "
"service %s not started.", "for service %s not started.",
port->protocol, port->protocol,
service->name); service->name);
return 0; return 0;

View File

@ -678,7 +678,7 @@ int snprint_timestamp(
tm.tm_sec); tm.tm_sec);
return_p_ts: return_p_ts:
return (MIN(tslen,timestamp_len)); return (strlen(p_ts));
} }
@ -1664,13 +1664,13 @@ static bool file_write_footer(
const char* header_buf4; const char* header_buf4;
CHK_FILE(file); CHK_FILE(file);
header_buf1 = "MaxScale is shut down\t"; header_buf1 = "MaxScale is shut down.\t";
tslen = get_timestamp_len(); tslen = get_timestamp_len();
header_buf3 = (char *)malloc(tslen); header_buf3 = (char *)malloc(tslen);
if (header_buf3 == NULL) { if (header_buf3 == NULL) {
goto return_succp; goto return_succp;
} }
tslen = snprint_timestamp(header_buf3, tslen); tslen = snprint_timestamp(header_buf3, tslen-1);
header_buf4 = "\n--------------------------------------------" header_buf4 = "\n--------------------------------------------"
"---------------------------\n"; "---------------------------\n";