static int __dispatch_app_result(request_h req)
{
bundle *kb;
- int pid;
+ int caller_pid;
+ int caller_pgid;
int pgid;
char tmp_pid[MAX_PID_STR_BUFSZ];
int res;
if (kb == NULL)
return -1;
- pid = __get_caller_pid(kb);
- if (pid < 0)
+ caller_pid = __get_caller_pid(kb);
+ if (caller_pid < 0)
return AUL_R_ERROR;
+ caller_pgid = getpgid(caller_pid);
+ if (caller_pgid < 0) {
+ _E("getpgid() is failed. caller_pid(%d)", caller_pid);
+ return AUL_R_ERROR;
+ }
+
pgid = getpgid(_request_get_pid(req));
if (pgid > 0) {
snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", pgid);
return AUL_R_ERROR;
__set_instance_id(kb);
- app_status = _app_status_find(getpgid(pid));
+ app_status = _app_status_find(caller_pgid);
appid = _app_status_get_appid(app_status);
_noti_send(AMD_NOTI_MSG_LAUNCH_APP_RESULT_START,
info = __find_result_info(seq);
if (info) {
- res = aul_sock_send_bundle_with_fd(info->fd, pid, kb,
+ res = aul_sock_send_bundle_with_fd(info->fd, pgid, kb,
AUL_SOCK_NOREPLY);
__remove_result_info(info);
__destroy_result_info(info);
} else {
- res = aul_sock_send_bundle(pid, target_uid,
+ res = aul_sock_send_bundle(caller_pgid, target_uid,
_request_get_cmd(req), kb,
AUL_SOCK_NOREPLY);
}
res = AUL_R_ERROR;
_noti_send(AMD_NOTI_MSG_LAUNCH_APP_RESULT_END,
- pid, target_uid, GINT_TO_POINTER(res), NULL);
+ caller_pgid, target_uid, GINT_TO_POINTER(res), NULL);
return 0;
}
{
char buf[MAX_PID_STR_BUFSZ];
- snprintf(buf, sizeof(buf), "%d", caller_pid);
+ snprintf(buf, sizeof(buf), "%d", getpgid(caller_pid));
bundle_del(kb, AUL_K_CALLER_PID);
bundle_add(kb, AUL_K_CALLER_PID, buf);