Commit 4b71da94 authored by Maria Fava's avatar Maria Fava
Browse files

fix style a bit

parent 0f5a3307
......@@ -55,14 +55,16 @@ void ADDHCmd::commandReceived(ntof::dim::DIMCmd &cmdData)
command.timingEvent = timingEvent;
command.filePath = filePath;
std::string filePathPrefix = Config::instance().getValue("outputDirPrefix", "ADDH/Prefix");
std::string filePathPrefix = Config::instance().getValue(
"outputDirPrefix", "ADDH/Prefix");
// Check if filePath is subpath of filePathPrefix
if(isValidPath(filePath, filePathPrefix))
if (isValidPath(filePath, filePathPrefix))
{
// Check if the command can be accepted
LOG(INFO) << "Command " << textValue << " received.";
if (textValue != "write" && textValue != "reset" && textValue != "clear")
if (textValue != "write" && textValue != "reset" &&
textValue != "clear")
{
setError(cmdData.getKey(), CMD_UNKNOWN, "Command unknown.");
}
......@@ -86,14 +88,14 @@ void ADDHCmd::commandReceived(ntof::dim::DIMCmd &cmdData)
bool ADDHCmd::isValidPath(std::string filePath, std::string filePathPrefix)
{
if(filePath[0] != '/')
if (filePath[0] != '/')
{
// filePath is relative, convert to absolute
char* absoluteFilePath = realpath(filePath.c_str(), NULL);
char *absoluteFilePath = realpath(filePath.c_str(), NULL);
filePath = absoluteFilePath;
free(absoluteFilePath);
}
if(filePath.find(filePathPrefix) != std::string::npos)
if (filePath.find(filePathPrefix) != std::string::npos)
{
return true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment