From 74b03e07f213f5bb20e6192167674e3372960274 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 19 Apr 2018 16:22:05 +0900 Subject: [PATCH] Fix setting AUL environment variables - Removes deleting the environment variables Change-Id: Id4329a4702e4f70d4437b606816ba4f5a840d8de Signed-off-by: Hwankyu Jhun --- src/pkginfo.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/pkginfo.c b/src/pkginfo.c index c6d7acc..0f20b27 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -33,9 +33,9 @@ typedef struct _internal_param_t { void *user_data; } internal_param_t; -static const char *__appid = NULL; -static const char *__pkgid = NULL; -static const char *__root_path = NULL; +static const char *__appid; +static const char *__pkgid; +static const char *__root_path; API int aul_app_get_pid(const char *appid) { @@ -220,14 +220,8 @@ API void aul_set_preinit_appid(const char *appid) const char *__get_preinit_appid(void) { - const char *appid; - - appid = getenv("AUL_APPID"); - if (appid) { - if (__appid == NULL) - __appid = strdup(appid); - unsetenv("AUL_APPID"); - } + if (!__appid) + __appid = getenv("AUL_APPID"); return __appid; } @@ -239,14 +233,8 @@ API void aul_set_preinit_pkgid(const char *pkgid) const char *__get_preinit_pkgid(void) { - const char *pkgid; - - pkgid = getenv("AUL_PKGID"); - if (pkgid) { - if (__pkgid == NULL) - __pkgid = strdup(pkgid); - unsetenv("AUL_PKGID"); - } + if (!__pkgid) + __pkgid = getenv("AUL_PKGID"); return __pkgid; } @@ -258,14 +246,8 @@ API void aul_set_preinit_root_path(const char *root_path) API const char *aul_get_preinit_root_path(void) { - const char *root_path; - - root_path = getenv("AUL_ROOT_PATH"); - if (root_path) { - if (__root_path == NULL) - __root_path = strdup(root_path); - unsetenv("AUL_ROOT_PATH"); - } + if (!__root_path) + __root_path = getenv("AUL_ROOT_PATH"); return __root_path; } -- 2.7.4