summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/launchpad_common.h1
-rwxr-xr-xsrc/launchpad.c3
-rw-r--r--src/launchpad_common.c13
3 files changed, 13 insertions, 4 deletions
diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h
index 7fb9ff6..ca63615 100644
--- a/inc/launchpad_common.h
+++ b/inc/launchpad_common.h
@@ -93,6 +93,7 @@ int _create_server_sock(const char *name);
app_pkt_t *_recv_pkt_raw(int fd, int *clifd, struct ucred *cr);
int _send_pkt_raw(int client_fd, app_pkt_t *pkt);
int _connect_to_launchpad(int type, int id);
+void _set_sock_option(int fd, int cli);
void _set_env(appinfo_t *menu_info, bundle * kb);
char** _create_argc_argv(bundle * kb, int *margc);
char *_get_libdir(const char *path);
diff --git a/src/launchpad.c b/src/launchpad.c
index 58985ad..62a268e 100755
--- a/src/launchpad.c
+++ b/src/launchpad.c
@@ -202,6 +202,8 @@ static int __accept_candidate_process(int server_fd, int *out_client_fd,
goto error;
}
+ _set_sock_option(client_fd, 1);
+
recv_ret = recv(client_fd, &client_pid, sizeof(client_pid), MSG_WAITALL);
if (recv_ret == -1) {
@@ -384,6 +386,7 @@ static int __prepare_candidate_process(int type, int loader_id)
pid = fork();
if (pid == 0) { /* child */
__signal_unblock_sigchld();
+ __signal_fini();
type_str[0] = '0' + type;
snprintf(loader_id_str, sizeof(loader_id_str), "%d", loader_id);
diff --git a/src/launchpad_common.c b/src/launchpad_common.c
index 6cc911c..c3f942d 100644
--- a/src/launchpad_common.c
+++ b/src/launchpad_common.c
@@ -74,16 +74,21 @@ static int __read_proc(const char *path, char *buf, int size)
return ret;
}
-static void __set_sock_option(int fd, int cli)
+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);
+ }
}
static int __parse_app_path(const char *arg, char *out, int out_size)
@@ -212,7 +217,7 @@ int _create_server_sock(const char *name)
return -1;
}
- __set_sock_option(fd, 0);
+ _set_sock_option(fd, 0);
if (listen(fd, 128) == -1) {
_E("listen error");
@@ -252,7 +257,7 @@ app_pkt_t *_recv_pkt_raw(int fd, int *clifd, struct ucred *cr)
return NULL;
}
- __set_sock_option(*clifd, 1);
+ _set_sock_option(*clifd, 1);
retry_recv:
/* receive header(cmd, datalen) */