Skip to content

Commit e8f2268

Browse files
authored
Merge pull request #73 from sy-c/master
next version
2 parents 09ee847 + 9fbdc49 commit e8f2268

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

apps/Alf.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ class Alf : public AliceO2::Common::Program
108108
maxFiles = static_cast<unsigned int>(std::stoul(mOptions.dimLogFileConfig.substr(start)));
109109
}
110110
}
111-
alfDebugLog.setLogFile(path.c_str(), maxBytes, maxFiles, 1);
111+
const char* debugLogFile = path.c_str();
112+
if (path == "stdout") debugLogFile = NULL; // handle special string to set logs go to stdout
113+
alfDebugLog.setLogFile(debugLogFile, maxBytes, maxFiles, 1);
112114
alfDebugLog.setOutputFormat(SimpleLog::FormatOption::ShowTimeStamp | SimpleLog::FormatOption::ShowSeveritySymbol | SimpleLog::FormatOption::ShowMessage );
113115
alfDebugLog.info("ALF starting");
114116
} else {

src/DimServices/DimServices.cxx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ void StringRpcServer::rpcHandler()
103103
{
104104
// build a safe string from DIM input. Parent method getString() is unsafe, not guarateed to be nul-terminated
105105
std::string inputString;
106-
if (auto data = getString(); data && getSize() > 0) {
107-
inputString.assign(data, getSize());
106+
{
107+
auto data = getString();
108+
auto size = getSize();
109+
if (data && (size > 0)) {
110+
inputString.assign(data, strnlen(data, size));
111+
}
108112
}
109113

110-
alfDebugLog.info("Request received on %s : %s",mServiceName.c_str(),inputString.c_str());
114+
alfDebugLog.info("Request received on %s (%d bytes) :\n%s",mServiceName.c_str(), (int)getSize(), inputString.c_str());
111115
try {
112116
auto returnValue = mCallback(inputString);
113117
setDataString(makeSuccessString(returnValue), *this);

0 commit comments

Comments
 (0)