From: Hwankyu Jhun Date: Mon, 5 Oct 2020 10:09:28 +0000 (+0900) Subject: Check AUL process ID X-Git-Tag: accepted/tizen/6.0/unified/20201030.122505~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1b5fa8463128fc84c71e06541587913a01ef781;p=platform%2Fcore%2Fappfw%2Faul-1.git Check AUL process ID If the AUL process ID is not equal to current process ID, AUL creates a new app socket. Change-Id: Ia353ec7ff4505b8174365eb8c435b18dbb069361 Signed-off-by: Hwankyu Jhun --- diff --git a/src/launch.c b/src/launch.c index 5ad3a76..0d0cf66 100755 --- a/src/launch.c +++ b/src/launch.c @@ -51,7 +51,7 @@ static void *__conformant_object = NULL; static void __clear_internal_key(bundle *kb); static inline void __set_stime(bundle *kb); -int aul_is_initialized() +int aul_is_initialized(void) { return aul_initialized; } @@ -276,11 +276,32 @@ int app_request_to_launchpad_for_uid(int cmd, const char *appid, bundle *kb, uid return ret; } +static int __check_env_pid(void) +{ + const char *env_str; + int env_pid; + + env_str = getenv("AUL_PID"); + if (env_str && isdigit(*env_str)) { + env_pid = atoi(env_str); + if (env_pid != getpid()) { + _W("pid(%d) is not equal to AUL_PID(%d)", + getpid(), env_pid); + return -1; + } + } + + return 0; +} + static int __get_preinit_fd(void) { int fd = -1; const char *listen_fd; + if (__check_env_pid() != 0) + return fd; + listen_fd = getenv("AUL_LISTEN_FD"); if (listen_fd) { if (isdigit(*listen_fd)) @@ -291,7 +312,7 @@ static int __get_preinit_fd(void) return fd; } -int aul_initialize() +int aul_initialize(void) { int flag; diff --git a/src/launch.h b/src/launch.h index be5ca59..5a2eb61 100644 --- a/src/launch.h +++ b/src/launch.h @@ -18,8 +18,8 @@ #include -int aul_initialize(); -int aul_is_initialized(); +int aul_initialize(void); +int aul_is_initialized(void); int aul_app_register_pid(const char *appid, int pid); int app_send_cmd(int pid, int cmd, bundle *kb);