typedef void MediaDBHandle; /**< Handle */
-int media_db_connect(MediaDBHandle **handle, uid_t uid, bool needWrite);
+int media_db_connect(MediaDBHandle **handle, uid_t uid, bool need_write);
int media_db_disconnect(MediaDBHandle *handle);
result = cynara_check(_cynara, creds->smack, session, creds->uid, privilege);
G_UNLOCK(cynara_mutex);
- if (result < 0)
+ if (result != CYNARA_API_ACCESS_ALLOWED)
ms_cynara_dbg_err("cynara_check", result);
MS_SAFE_FREE(session);
int ms_cynara_enable_credentials_passing(int fd)
{
const int optval = 1;
- int r;
+ int err;
- r = setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &optval, sizeof(optval));
- if (r != 0) {
+ err = setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &optval, sizeof(optval));
+ if (err != 0) {
MSAPI_DBG_ERR("Failed to set SO_PASSSEC socket option");
return MS_MEDIA_ERR_SOCKET_INTERNAL;
}
- r = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &optval, sizeof(optval));
- if (r != 0) {
+ err = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &optval, sizeof(optval));
+ if (err != 0) {
MSAPI_DBG_ERR("Failed to set SO_PASSCRED socket option");
return MS_MEDIA_ERR_SOCKET_INTERNAL;
}
static __thread int g_list_idx = 0;
static int __media_db_busy_handler(void *pData, int count);
-static int __media_db_connect_db_with_handle(sqlite3 **db_handle, uid_t uid, bool needWrite);
+static int __media_db_connect_db_with_handle(sqlite3 **db_handle, uid_t uid, bool need_write);
static int __media_db_disconnect_db_with_handle(sqlite3 *db_handle);
static void __media_db_destroy_sql_list()
return result_psswd;
}
-static int __media_db_connect_db_with_handle(sqlite3 **db_handle,uid_t uid, bool needWrite)
+static int __media_db_connect_db_with_handle(sqlite3 **db_handle,uid_t uid, bool need_write)
{
int ret = SQLITE_OK;
/*Connect DB*/
- if (needWrite) {
+ if (need_write) {
ret = db_util_open_with_options(__media_get_media_DB(uid), db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
} else {
ret = db_util_open_with_options(__media_get_media_DB(uid), db_handle, SQLITE_OPEN_READONLY, NULL);
return ret;
}
-int media_db_connect(MediaDBHandle **handle, uid_t uid, bool needWrite)
+int media_db_connect(MediaDBHandle **handle, uid_t uid, bool need_write)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3 * db_handle = NULL;
MSAPI_DBG_FUNC();
- ret = __media_db_connect_db_with_handle(&db_handle,uid, needWrite);
+ ret = __media_db_connect_db_with_handle(&db_handle,uid, need_write);
MSAPI_RETV_IF(ret != MS_MEDIA_ERR_NONE, ret);
*handle = db_handle;