Change ownership of TAC database file in dotnettool
authorj-h.choi <j-h.choi@samsung.com>
Tue, 8 Oct 2019 00:41:00 +0000 (09:41 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Wed, 9 Oct 2019 22:37:57 +0000 (07:37 +0900)
NativeLauncher/tool/tac_common.cc

index 19250e7..771db08 100644 (file)
@@ -175,6 +175,9 @@ tac_error_e restoreTACDB()
                tac_db = NULL;
        }
 
+       uid_t g_uid = 301; // app_fw
+       gid_t g_gid = 301; // app_fw
+
        if (!copyFile(TAC_APP_LIST_RESTORE_DB, TAC_APP_LIST_DB)) {
                fprintf(stderr, "Failed to copy of %s\n", TAC_APP_LIST_DB);
                return TAC_ERROR_UNKNOWN;
@@ -183,6 +186,9 @@ tac_error_e restoreTACDB()
                fprintf(stderr, "Failed to remove of %s\n", TAC_APP_LIST_RESTORE_DB);
                return TAC_ERROR_UNKNOWN;
        }
+       if (chown(TAC_APP_LIST_DB, g_uid, g_gid) == -1) {
+               fprintf(stderr, "Failed to change owner and group name\n");
+       }
 
        std::string dbJournal = TAC_APP_LIST_DB + std::string("-journal");
        if (!copyFile(dbRestoreJournal, dbJournal)) {
@@ -193,8 +199,12 @@ tac_error_e restoreTACDB()
                fprintf(stderr, "Failed to remove of %s\n", dbRestoreJournal.c_str());
                return TAC_ERROR_UNKNOWN;
        }
+       if (chown(dbJournal.c_str(), g_uid, g_gid) == -1) {
+               fprintf(stderr, "Failed to change owner and group name\n");
+       }
 
        cleanupDirectory();
+
        return TAC_ERROR_NONE;
 }