From 865f5a9404d4b3f41ccac0d65e647e7ec57e065c Mon Sep 17 00:00:00 2001 From: enWILLYado Date: Tue, 27 Feb 2018 00:17:59 +0100 Subject: [PATCH] Fixes in Linux --- src/interfaces/IConsoleListener.h | 1 + src/log/SysLog.cpp | 2 +- src/net/Url.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/interfaces/IConsoleListener.h b/src/interfaces/IConsoleListener.h index 51aaf50c..af624ace 100644 --- a/src/interfaces/IConsoleListener.h +++ b/src/interfaces/IConsoleListener.h @@ -24,6 +24,7 @@ #ifndef __ICONSOLELISTENER_H__ #define __ICONSOLELISTENER_H__ +#include "interfaces/interface.h" class IConsoleListener { diff --git a/src/log/SysLog.cpp b/src/log/SysLog.cpp index cdafd508..91126ea4 100644 --- a/src/log/SysLog.cpp +++ b/src/log/SysLog.cpp @@ -43,7 +43,7 @@ void SysLog::text(const std::string & txt) void SysLog::message(Level level, const std::string & txt) { - syslog(level == INFO ? LOG_INFO : LOG_NOTICE, "%s", txt); + syslog(level == INFO ? LOG_INFO : LOG_NOTICE, "%s", txt.c_str()); } #endif \ No newline at end of file diff --git a/src/net/Url.cpp b/src/net/Url.cpp index 5de11a55..90f2de6b 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -236,7 +236,7 @@ void Url::applyExceptions() } -static std::string & replace(std::string & str, const std::string & what, const std::string & other) +static std::string & Replace(std::string & str, const std::string & what, const std::string & other) { if(str.empty() || what.empty() || what == other) { @@ -256,7 +256,7 @@ static std::string & replace(std::string & str, const std::string & what, const static std::string replaceWithTokens(const std::string & value) { char hostname[1024] = {'\0'}; - gethostname(hostname, sizeof(hostname)); + gethostname(hostname, sizeof(hostname) - 1); struct hostent* hostentry = gethostbyname(hostname); // get ip @@ -284,8 +284,8 @@ static std::string replaceWithTokens(const std::string & value) // set user replacing tokens std::string ret = value; - ret = replace(ret, "%HOST_NAME%", hostname); - ret = replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf); + ret = Replace(ret, "%HOST_NAME%", hostname); + ret = Replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf); return ret; }