From 7562e0f3eaa852515256e268cf8541dd8fb84985 Mon Sep 17 00:00:00 2001 From: shivajm Date: Mon, 27 Jan 2014 10:27:22 +0530 Subject: [PATCH] Fix For PTREL-284 : Multi-User Architecture Change added review comments Change-Id: I25a0d4639ced39125e2e67c85ab6c7122beae9f9 Signed-off-by: shivajm --- CMakeLists.txt | 2 +- packaging/tel-plugin-atmodem.spec | 15 ++++++++------- src/s_network.c | 6 +++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d943aca..96c239b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(INCLUDEDIR "\${prefix}/include") # Set required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog) +pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog libtzplatform-config) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/packaging/tel-plugin-atmodem.spec b/packaging/tel-plugin-atmodem.spec index 5fbf357..b94482f 100644 --- a/packaging/tel-plugin-atmodem.spec +++ b/packaging/tel-plugin-atmodem.spec @@ -13,6 +13,7 @@ BuildRequires: cmake BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(tcore) +BuildRequires: pkgconfig(libtzplatform-config) %description Telephony AT Modem library @@ -28,23 +29,23 @@ make %{?jobs:-j%jobs} %post /sbin/ldconfig -mkdir -p /opt/dbspace +mkdir -p %{TZ_SYS_DB} -if [ ! -f /opt/dbspace/.mcc_mnc_oper_list.db ] +if [ ! -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db ] then - sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql + sqlite3 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql fi rm -f /tmp/mcc_mnc_oper_list.sql -if [ -f /opt/dbspace/.mcc_mnc_oper_list.db ] +if [ -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db ] then -chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db +chmod 600 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db fi -if [ -f /opt/dbspace/.mcc_mnc_oper_list.db-journal ] +if [ -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db-journal ] then -chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal +chmod 644 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db-journal fi %postun -p /sbin/ldconfig diff --git a/src/s_network.c b/src/s_network.c index 3a54b21..dfad647 100644 --- a/src/s_network.c +++ b/src/s_network.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "s_common.h" #include "s_network.h" @@ -135,12 +136,15 @@ static void _insert_mcc_mnc_oper_list(TcorePlugin *plugin, CoreObject *o) gpointer key, value; GHashTable *result = NULL, *row = NULL; struct tcore_network_operator_info *noi = NULL; + const char *path = NULL; int count = 0; s = tcore_plugin_ref_server(plugin); strg = tcore_server_find_storage(s, "database"); - handle = tcore_storage_create_handle(strg, "/opt/dbspace/.mcc_mnc_oper_list.db"); + path = tzplatform_mkpath(TZ_SYS_DB, ".mcc_mnc_oper_list.db"); + + handle = tcore_storage_create_handle(strg, path); if (!handle) { dbg("fail to create database handle"); return; -- 2.7.4