From fa670dfe15c426792821b7d6c9df6dd53f6aea3c Mon Sep 17 00:00:00 2001 From: enWILLYado Date: Mon, 26 Feb 2018 23:28:50 +0100 Subject: [PATCH] Fix unix compilation --- src/net/Url.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/Url.cpp b/src/net/Url.cpp index 0b0ff4db..5de11a55 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -26,6 +26,7 @@ #include #ifndef _WIN32 +#include #include #include #include @@ -254,7 +255,6 @@ static std::string & replace(std::string & str, const std::string & what, const static std::string replaceWithTokens(const std::string & value) { - char hosturl[1024] = {'\0'}; char hostname[1024] = {'\0'}; gethostname(hostname, sizeof(hostname)); struct hostent* hostentry = gethostbyname(hostname); @@ -285,7 +285,7 @@ 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); + ret = replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf); return ret; }