firmware_handler: allow committing repeatedly

Committing repeatedly while a commit is in progress has no effect and
just returns success to the caller.  Previous behavior was to fail.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ie237d68f661e7f0a93700724a512e1d9965663a1
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 8c9ad43..c7164dc 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -538,10 +538,10 @@
         return false;
     }
 
-    /* Can only be called once per verification. */
+    /* Calling repeatedly has no effect within an update process. */
     if (state == UpdateState::verificationStarted)
     {
-        return false;
+        return true;
     }
 
     /* Set state to committing. */
diff --git a/test/firmware_commit_unittest.cpp b/test/firmware_commit_unittest.cpp
index 7dca2b4..425e7b9 100644
--- a/test/firmware_commit_unittest.cpp
+++ b/test/firmware_commit_unittest.cpp
@@ -103,9 +103,10 @@
     EXPECT_TRUE(handler->commit(0, {}));
 }
 
-TEST(FirmwareHandlerCommitTest, VerifyCommitCanOnlyBeCalledOnce)
+TEST(FirmwareHandlerCommitTest, VerifyCommitCanOnlyBeCalledOnceForEffect)
 {
-    /* Verify you cannot call the commit() command once verification is started.
+    /* Verify you cannot call the commit() command once verification is
+     * started, after which it will just return true.
      */
     ImageHandlerMock imageMock1, imageMock2;
     std::vector<HandlerPack> blobs = {
@@ -143,7 +144,7 @@
     EXPECT_CALL(sdbus_mock, sd_bus_call(_, _, _, _, _)).WillOnce(Return(0));
 
     EXPECT_TRUE(handler->commit(0, {}));
-    EXPECT_FALSE(handler->commit(0, {}));
+    EXPECT_TRUE(handler->commit(0, {}));
 }
 
 } // namespace blobs