Set default value for launch_mode
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_certinfo.c
index 0e5f24a..c626b51 100644 (file)
@@ -603,6 +603,8 @@ API int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h ha
                return PMINFO_R_EINVAL;
        }
 
+       _check_create_cert_db();
+
        /* open unified global cert db */
        dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
        if (dbpath == NULL)
@@ -623,8 +625,6 @@ API int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h ha
                return PMINFO_R_ERROR;
        }
 
-       _check_create_cert_db(db);
-
        if (_pkginfo_save_cert_index_info(db, info->cert_info)) {
                _LOGE("failed to save cert index info, rollback now");
                sqlite3_exec(GET_DB(cert_db), "ROLLBACK", NULL, NULL, NULL);
@@ -721,7 +721,7 @@ API int pkgmgrinfo_delete_usr_certinfo(const char *pkgid, uid_t uid)
        if (dbpath == NULL)
                return PMINFO_R_ERROR;
 
-       ret = __open_db(dbpath, &db, SQLITE_OPEN_READWRITE, NULL);
+       ret = __open_db(dbpath, &db, SQLITE_OPEN_READWRITE);
        if (ret != SQLITE_OK) {
                _LOGE("failed to open db: %d", ret);
                free(dbpath);