From 1a3fa578da7e6e824a4a6a85109fc9de411bd4c8 Mon Sep 17 00:00:00 2001 From: vraatikka Date: Tue, 12 Nov 2013 17:49:28 +0200 Subject: [PATCH] Fixed snprint_timestamp function which left one byte garbage to log file. --- server/core/service.c | 4 ++-- utils/skygw_utils.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/core/service.c b/server/core/service.c index 2bbd5cb7f..2f4725fdd 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -123,8 +123,8 @@ GWPROTOCOL *funcs; port->listener = NULL; skygw_log_write_flush( LOGFILE_ERROR, - "Error : Unable to load protocol module %s. Listener for " - "service %s not started.", + "Error : Unable to load protocol module %s. Listener " + "for service %s not started.", port->protocol, service->name); return 0; diff --git a/utils/skygw_utils.cc b/utils/skygw_utils.cc index 5fdd706e2..4c66bbd58 100644 --- a/utils/skygw_utils.cc +++ b/utils/skygw_utils.cc @@ -678,7 +678,7 @@ int snprint_timestamp( tm.tm_sec); 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; CHK_FILE(file); - header_buf1 = "MaxScale is shut down\t"; + header_buf1 = "MaxScale is shut down.\t"; tslen = get_timestamp_len(); header_buf3 = (char *)malloc(tslen); if (header_buf3 == NULL) { goto return_succp; } - tslen = snprint_timestamp(header_buf3, tslen); + tslen = snprint_timestamp(header_buf3, tslen-1); header_buf4 = "\n--------------------------------------------" "---------------------------\n";