Skip to content

Commit

Permalink
Merge pull request #1676 from FIWARE/dds/log
Browse files Browse the repository at this point in the history
Protection for NULL fileName/funcName in DDS log
  • Loading branch information
kzangeli authored Sep 25, 2024
2 parents 0e04669 + dae8483 commit 10fbf28
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/lib/orionld/dds/ddsInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,44 @@ DdsOperationMode ddsOpMode;



// -----------------------------------------------------------------------------
//
// ddsNotification -
//
void ddsNotification(const char* typeName, const char* topicName, const char* json, double publishTime)
{
KT_T(StDds, "Got a notification on %s:%s (json: %s)", typeName, topicName, json);
}



// -----------------------------------------------------------------------------
//
// ddsTypeNotification -
//
void ddsTypeNotification(const char* typeName, const char* topicName, const char* serializedType)
{
KT_T(StDds, "Got a type notification ('%s', '%s', '%s')", typeName, topicName, serializedType);
}


// -----------------------------------------------------------------------------
//
// ddsLog -
//
void ddsLog(const char* fileName, int lineNo, const char* funcName, int category, const char* msg)
{
int level = 0;
char severity = ddsCategoryToKlogSeverity(category, &level);

ktOut(fileName, lineNo, funcName, severity, level, msg);
char* filename = (fileName != NULL)? (char*) fileName : (char*) "no-filename";
char* funcname = (funcName != NULL)? (char*) funcName : (char*) "no-funcname";

ktOut(filename, lineNo, funcname, severity, level, msg);
}



// -----------------------------------------------------------------------------
//
// ddsInit - initialization function for DDS
Expand Down

0 comments on commit 10fbf28

Please sign in to comment.