Drop unused LogPrefix variable

Also gets rid of a potentially problematic strncpy() use that causes a
gcc warning: specified bound 256 equals destination size
[-Werror=stringop-truncation].

(Whether that would have caused a problem or not depends on how
LogPrefix would have been used, and whether it ever would have been
filled completely, without any terminating nul character, by that
strncpy().)

Change-Id: I92dba3726e3f46777d9b4c8cf88f557c02788fe0
This commit is contained in:
Tor Lillqvist
2018-07-19 12:08:26 +03:00
parent ff31f2dba1
commit eae43a262b

View File

@ -33,8 +33,6 @@
#include "Log.hpp"
#include "Util.hpp"
static char LogPrefix[256] = { '\0' };
namespace Log
{
using namespace Poco;
@ -140,8 +138,6 @@ namespace Log
oss << Source.name << '-'
<< std::setw(5) << std::setfill('0') << Poco::Process::id();
Source.id = oss.str();
assert (sizeof (LogPrefix) > strlen(oss.str().c_str()) + 1);
strncpy(LogPrefix, oss.str().c_str(), sizeof(LogPrefix));
// Configure the logger.
AutoPtr<Channel> channel;