Change not to reboot when error occurs in internal encryption 83/114483/2
authorSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 13 Feb 2017 11:29:09 +0000 (20:29 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 13 Feb 2017 11:31:04 +0000 (03:31 -0800)
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Change-Id: I4dd7bb8697625b958eedfc21273d291136c79763

server/internal-encryption.cpp

index d015184..4dbcf13 100644 (file)
@@ -215,7 +215,6 @@ int InternalEncryption::encrypt(const std::string& password, unsigned int option
                        }
 
                        INFO("Encryption started...");
-                       ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        engine->encrypt(MasterKey, options);
                        setOptions(options & getSupportedOptions());
                        INFO("Sync disk...");
@@ -223,10 +222,11 @@ int InternalEncryption::encrypt(const std::string& password, unsigned int option
                        INFO("Encryption completed");
 
                        ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "encrypted");
+                       ::reboot(RB_AUTOBOOT);
                } catch (runtime::Exception &e) {
+                       ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        ERROR("Encryption failed - " + std::string(e.what()));
                }
-               ::reboot(RB_AUTOBOOT);
        };
 
        std::thread asyncWork(encryptWorker);
@@ -266,17 +266,17 @@ int InternalEncryption::decrypt(const std::string& password)
                        }
 
                        INFO("Decryption started...");
-                       ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        engine->decrypt(MasterKey, getOptions());
                        INFO("Sync disk...");
                        sync();
                        INFO("Decryption completed");
 
                        ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "unencrypted");
+                       ::reboot(RB_AUTOBOOT);
                } catch (runtime::Exception &e) {
+                       ::vconf_set_str(INTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        ERROR("Decryption failed - " + std::string(e.what()));
                }
-               ::reboot(RB_AUTOBOOT);
        };
 
        std::thread asyncWork(decryptWorker);