diff --git a/slsDetectorSoftware/sharedMemory/SharedMemory.h b/slsDetectorSoftware/sharedMemory/SharedMemory.h index f724dc1e3..24c2f5aa5 100644 --- a/slsDetectorSoftware/sharedMemory/SharedMemory.h +++ b/slsDetectorSoftware/sharedMemory/SharedMemory.h @@ -195,7 +195,7 @@ class SharedMemory { /** * Maximum length of name as from man pages */ - static const int name_max_length = 255; + static const int NAME_MAX_LENGTH = 255; /** *Using the call operator to access the pointer @@ -236,8 +236,8 @@ class SharedMemory { ss << SHM_MULTI_PREFIX << multiId << SHM_SLS_PREFIX << slsId << sEnvPath; std::string temp = ss.str(); - if (temp.length() > name_max_length) { - std::string msg = "Shared memory initialization failed. " + temp + " has " + std::to_string(temp.length()) + " characters. \n" + "Maximum is " + std::to_string(name_max_length) + ". Change the environment variable " + SHM_ENV_NAME; + if (temp.length() > NAME_MAX_LENGTH) { + std::string msg = "Shared memory initialization failed. " + temp + " has " + std::to_string(temp.length()) + " characters. \n" + "Maximum is " + std::to_string(NAME_MAX_LENGTH) + ". Change the environment variable " + SHM_ENV_NAME; FILE_LOG(logERROR) << msg; throw SharedMemoryError(msg); } @@ -301,4 +301,4 @@ class SharedMemory { T *shared_struct{nullptr}; }; -} // namespace sls \ No newline at end of file +} // namespace sls diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index a88bbb430..dfe694f18 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -426,7 +426,7 @@ int slsReceiverTCPIPInterface::set_port() { } catch(SocketError &e) { ret = FAIL; // same socket, could not bind port - sprintf(mess, e.what()); + sprintf(mess, "%s", e.what()); FILE_LOG(logERROR) << mess; } catch (...) { ret = FAIL;