{
struct reply_info *r_info = (struct reply_info *) data;
int fd = r_info->gpollfd->fd;
+ int ret = -EAGAIN;
_E("application is not responding : pid(%d) cmd(%d)", r_info->pid, r_info->cmd);
_E("fail to killing - %d\n", r_info->pid);
__real_send(r_info->clifd, -1);
return -1;
+ } else {
+ ret = 0;
}
- __real_send(r_info->clifd, 0);
break;
}
+ __real_send(r_info->clifd, ret);
g_source_remove_poll(r_info->src, r_info->gpollfd);
g_source_destroy(r_info->src);
g_free(r_info->gpollfd);
if (gpollfd == NULL) {
_E("out of memory");
g_source_unref(src);
+ close(fd);
+ close(clifd);
return;
}
_E("out of memory");
g_free(gpollfd);
g_source_unref(src);
+ close(fd);
+ close(clifd);
return;
}
if (pid > 0) {
if ((ret = __nofork_processing(cmd, pid, kb, fd)) < 0) {
pid = ret;
+ } else {
+ delay_reply = 1;
}
} else if (cmd != APP_RESUME) {
#ifdef _APPFW_FEATURE_DEBUG_LAUNCHPAD
static int __send_result_to_client(int fd, int res)
{
+ if (fd < 0)
+ return -1;
+
_D("__send_result_to_client, res: %d", fd, res);
if (send(fd, &res, sizeof(int), MSG_NOSIGNAL) < 0) {
static void __real_send(int clifd, int ret)
{
- if(clifd <= 0) {
+ if (clifd < 0)
return;
- }
+
if (send(clifd, &ret, sizeof(int), MSG_NOSIGNAL) < 0) {
if (errno == EPIPE) {
_E("send failed due to EPIPE.\n");
int ret = -1;
int dummy;
- if (pkg_name == NULL)
+ if (pkg_name == NULL) {
+ close(clifd);
return -1;
+ }
pid = atoi(pkg_name);
if (pid <= 1) {
_E("invalid pid");
+ close(clifd);
return -1;
}
char buf[512];
if (_status_get_pkgname_bypid(pid, buf, 512) == -1) {
_E("request for unknown pid. It might not be a pid of app: %d", pid);
+ __real_send(clifd, -1);
return -1;
}
}
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
if(!pkt) {
_E("malloc fail");
+ close(fd);
return 0;
}
static inline void __set_sock_option(int fd, int cli)
{
int size;
+ int flag;
struct timeval tv = { 5, 200 * 1000 }; /* 5.2 sec */
size = AUL_SOCK_MAXBUFF;
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
- if (cli)
+ if (cli) {
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+ flag = fcntl(fd, F_GETFD);
+ flag |= FD_CLOEXEC;
+ fcntl(fd, F_SETFD, flag);
+ }
}
int __create_server_sock(int pid)
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
if (NULL == pkt) {
_E("Malloc Failed!");
+ close(fd);
return -ENOMEM;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
if (NULL == pkt) {
_E("Malloc Failed!");
+ close(fd);
return -ENOMEM;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
if (NULL == pkt) {
_E("Malloc Failed!");
+ close(fd);
return -ENOMEM;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
if (NULL == pkt) {
_E("Malloc Failed!");
+ close(fd);
return NULL;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);