Change to allow duplicated mount/umount API calls for lockscreen
[platform/core/security/ode.git] / server / external-encryption.cpp
index 82d2690..0033904 100644 (file)
@@ -201,6 +201,11 @@ int ExternalEncryption::mount(const std::string &password)
                return -2;
        }
 
+       if (engine->isMounted()) {
+               INFO("Already mounted");
+               return 0;
+       }
+
        engine->mount(keyManager.getMasterKey(data), getOptions());
        context.notify("ExternalEncryption::mount");
 
@@ -213,6 +218,11 @@ int ExternalEncryption::umount()
                return -1;
        }
 
+       if (!engine->isMounted()) {
+               INFO("Already umounted");
+               return 0;
+       }
+
        INFO("Close all applications using external storage...");
        killDependedApplications();
        INFO("Umount external storage...");