Look for an exact match of transaction id

Currently the code would search for a matching string in the whole
TRANSACTION_ID=1234 string, but there may cases that this could
result in a false match.
Change to extract the id number out of the string to do an exact compare.

Change-Id: I2cc0e6b42937a36e9afb942c07c91c0b4469a963
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
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 @@
 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 @@
             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.