bmc: Replace fileOpen flag

Instead of keeping track of a fileOpen flag, keep track of fileOpen
using !lookup.empty() instead.

Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I09d16479d2a52deae5e8d63582376a27a6a39bb5
diff --git a/bmc/firmware_handler.cpp b/bmc/firmware_handler.cpp
index fede302..96b4eba 100644
--- a/bmc/firmware_handler.cpp
+++ b/bmc/firmware_handler.cpp
@@ -110,12 +110,12 @@
      * we cannot close an active session.  To enforce this, we only allow
      * deleting if there isn't a file open.
      */
-    if (fileOpen)
+    if (fileOpen())
     {
         return false;
     }
 
-    /* only includes states where fileOpen == false */
+    /* only includes states where fileOpen() == false */
     switch (state)
     {
         case UpdateState::notYetStarted:
@@ -315,7 +315,7 @@
      * verification process has begun -- which is done via commit() on the hash
      * blob_id, we no longer want to allow updating the contents.
      */
-    if (fileOpen)
+    if (fileOpen())
     {
         return false;
     }
@@ -356,7 +356,7 @@
             break;
         case UpdateState::verificationPending:
             /* Handle opening the verifyBlobId --> we know the image and hash
-             * aren't open because of the fileOpen check.  They can still open
+             * aren't open because of the fileOpen() check. They can still open
              * other files from this state to transition back into
              * uploadInProgress.
              *
@@ -369,7 +369,6 @@
 
                 lookup[session] = &verifyImage;
 
-                fileOpen = true;
                 return true;
             }
             break;
@@ -386,7 +385,6 @@
 
                 lookup[session] = &updateImage;
 
-                fileOpen = true;
                 return true;
             }
             else
@@ -516,7 +514,6 @@
     removeBlobId(verifyBlobId);
 
     changeState(UpdateState::uploadInProgress);
-    fileOpen = true;
 
     return true;
 }
@@ -753,7 +750,6 @@
     }
 
     lookup.erase(item);
-    fileOpen = false;
     return true;
 }