Change to allow duplicated mount/umount API calls for lockscreen
[platform/core/security/ode.git] / server / internal-encryption.cpp
index f1a1a0d..63c0f24 100644 (file)
@@ -234,6 +234,11 @@ int InternalEncryption::mount(const std::string& password)
                return -2;
        }
 
+    if (engine->isMounted()) {
+               INFO("Already mounted");
+               return 0;
+       }
+
        engine->mount(keyManager.getMasterKey(pwData), getOptions());
        context.notify("InternalEncryption::mount");
 
@@ -246,6 +251,11 @@ int InternalEncryption::umount()
                return -1;
        }
 
+       if (!engine->isMounted()) {
+               INFO("Already umounted");
+               return 0;
+       }
+
        INFO("Close all processes using internal storage...");
        stopDependedSystemdServices();
        INFO("Umount internal storage...");