if (hAccountDB) {
rc = db_util_close(hAccountDB);
if (rc == SQLITE_PERM) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("Access failed(SQLITE_PERM)");
return ACCOUNT_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
} else if (rc == SQLITE_BUSY) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("database busy");
return ACCOUNT_ERROR_DATABASE_BUSY;
+ /* LCOV_EXCL_STOP */
}
ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_FAILED, ("The database isn't connected. rc : %d", rc));
hAccountDB = NULL;
return ret;
}
-
static int _account_user_db_open(sqlite3 **p_hAccountDB, int mode, uid_t uid)
{
int rc = 0;
ACCOUNT_GET_USER_DB_DIR(account_db_dir, sizeof(account_db_dir), uid);
if ((-1 == access(account_db_dir, F_OK)) && uid != OWNER_ROOT) {
+ /* LCOV_EXCL_START */
int ret;
ret = mkdir(account_db_dir, 0755);
ACCOUNT_DEBUG("chown result = [%d]", ret);
ret = chmod(account_db_jn_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
ACCOUNT_DEBUG("chmod result = [%d]", ret);
+ /* LCOV_EXCL_STOP */
} else {
if (mode == ACCOUNT_DB_OPEN_READWRITE)
rc = db_util_open(account_db_path, p_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
}
if (_account_db_err_code(*p_hAccountDB) == SQLITE_PERM) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(*p_hAccountDB));
return ACCOUNT_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
}
if (rc == SQLITE_BUSY) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("busy handler fail.");
return ACCOUNT_ERROR_DATABASE_BUSY;
+ /* LCOV_EXCL_STOP */
}
ACCOUNT_RETURN_VAL((rc != SQLITE_PERM), {}, ACCOUNT_ERROR_PERMISSION_DENIED, ("Account permission denied rc : %d", rc));
uid = getuid();
if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("global db open fail. user not both root or global user");
return ACCOUNT_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
}
ACCOUNT_GET_GLOBAL_DB_PATH(account_db_path, sizeof(account_db_path));
}
if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
return ACCOUNT_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
}
if (rc == SQLITE_BUSY) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("busy handler fail.");
return ACCOUNT_ERROR_DATABASE_BUSY;
+ /* LCOV_EXCL_STOP */
}
ACCOUNT_RETURN_VAL((rc != SQLITE_PERM), {}, ACCOUNT_ERROR_PERMISSION_DENIED, ("Account permission denied rc : %d", rc));
if (g_refCntDB == 0) {
rc = db_util_close(g_hAccountGlobalDB);
if (rc == SQLITE_PERM) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("Access failed(SQLITE_PERM)");
return ACCOUNT_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
} else if (rc == SQLITE_BUSY) {
+ /* LCOV_EXCL_START */
ACCOUNT_ERROR("database busy");
return ACCOUNT_ERROR_DATABASE_BUSY;
+ /* LCOV_EXCL_STOP */
}
ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_FAILED, ("The database isn't connected. rc : %d", rc));
g_hAccountGlobalDB = NULL;
}
if (uid != OWNER_ROOT && uid != GLOBAL_USER) {
+ /* LCOV_EXCL_START */
_ERR("current process user is not root, uid=%d", uid);
return_code = ACCOUNT_ERROR_PERMISSION_DENIED;
goto RETURN;
+ /* LCOV_EXCL_STOP */
}
setpwent();