From 874c674c60bf58a65e0d6e65c5f6d20fff0db3cf Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 22 Aug 2016 14:17:25 -0700 Subject: [PATCH] debuggerd: set SOCK_NONBLOCK in accept rather than later. Change-Id: I95586984dd7aec798d75b150be238d5f6f7c91da --- debuggerd/debuggerd.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp index 61cceb048139..c578d658bd2c 100644 --- a/debuggerd/debuggerd.cpp +++ b/debuggerd/debuggerd.cpp @@ -193,8 +193,6 @@ static int read_request(int fd, debugger_request_t* out_request) { } ALOGV("reading tid"); - fcntl(fd, F_SETFL, O_NONBLOCK); - pollfd pollfds[1]; pollfds[0].fd = fd; pollfds[0].events = POLLIN; @@ -828,7 +826,7 @@ static int do_server() { socklen_t alen = sizeof(ss); ALOGV("waiting for connection\n"); - int fd = accept4(s, addrp, &alen, SOCK_CLOEXEC); + int fd = accept4(s, addrp, &alen, SOCK_CLOEXEC | SOCK_NONBLOCK); if (fd == -1) { ALOGE("accept failed: %s\n", strerror(errno)); continue;