Merge "Clean up CLOEXEC in debuggerd."
This commit is contained in:
commit
f405d245eb
1 changed files with 6 additions and 9 deletions
|
|
@ -685,10 +685,9 @@ static int do_server() {
|
||||||
act.sa_flags = SA_NOCLDWAIT;
|
act.sa_flags = SA_NOCLDWAIT;
|
||||||
sigaction(SIGCHLD, &act, 0);
|
sigaction(SIGCHLD, &act, 0);
|
||||||
|
|
||||||
int s = socket_local_server(SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
|
int s = socket_local_server(SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT,
|
||||||
if (s < 0)
|
SOCK_STREAM | SOCK_CLOEXEC);
|
||||||
return 1;
|
if (s == -1) return 1;
|
||||||
fcntl(s, F_SETFD, FD_CLOEXEC);
|
|
||||||
|
|
||||||
ALOGI("debuggerd: starting\n");
|
ALOGI("debuggerd: starting\n");
|
||||||
|
|
||||||
|
|
@ -698,14 +697,12 @@ static int do_server() {
|
||||||
socklen_t alen = sizeof(ss);
|
socklen_t alen = sizeof(ss);
|
||||||
|
|
||||||
ALOGV("waiting for connection\n");
|
ALOGV("waiting for connection\n");
|
||||||
int fd = accept(s, addrp, &alen);
|
int fd = accept4(s, addrp, &alen, SOCK_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd == -1) {
|
||||||
ALOGV("accept failed: %s\n", strerror(errno));
|
ALOGE("accept failed: %s\n", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
|
|
||||||
handle_request(fd);
|
handle_request(fd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue