summaryrefslogtreecommitdiffstats
path: root/log_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'log_manager.cpp')
-rw-r--r--log_manager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/log_manager.cpp b/log_manager.cpp
index 507ff25..d8f233c 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -23,6 +23,7 @@ namespace logging
void Manager::commit(uint64_t transactionId, std::string errMsg)
{
constexpr const auto transactionIdVar = "TRANSACTION_ID";
+ constexpr const auto transactionIdVarSize = strlen(transactionIdVar);
sd_journal *j = nullptr;
int rc = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
@@ -64,8 +65,10 @@ void Manager::commit(uint64_t transactionId, std::string errMsg)
continue;
}
- std::string result(data, length);
- if (result.find(transactionIdStr) == std::string::npos)
+ // The metadata field result will be TRANSACTION_ID=1234. Skip the
+ // TRANSACTION_ID piece and (=) sign to get the id number to compare.
+ if (strcmp((data + transactionIdVarSize + 1),
+ transactionIdStr.c_str()) != 0)
{
// The value of the TRANSACTION_ID metadata is not the requested
// transaction id number.
OpenPOWER on IntegriCloud