#include <sys/stat.h>
#include <db-util.h>
+#include <tzplatform_config.h>
#include "rua_util.h"
+#include "rua_internal.h"
char *_rua_util_get_db_path(uid_t uid, char *db_name)
{
char db_path[PATH_MAX];
+ const char *db_path_prefix;
- snprintf(db_path, sizeof(db_path), "/run/aul/dbspace/%d/%s",
+ if (strcmp(db_name, RUA_DB_NAME) == 0) {
+ snprintf(db_path, sizeof(db_path), "/run/aul/dbspace/%d/%s",
uid, db_name);
+ } else {
+ tzplatform_set_user(uid);
+ db_path_prefix = tzplatform_getenv(TZ_USER_DB);
+ tzplatform_reset_user();
+ snprintf(db_path, sizeof(db_path), "%s/%s", db_path_prefix, db_name);
+ }
LOGD("db path %s", db_path);
-
return strdup(db_path);
}