diff options
author | Yabin Cui <yabinc@google.com> | 2015-10-06 15:10:05 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2015-10-06 16:15:30 -0700 |
commit | 6dfef255b8fa77e3b5c0a69b7f276ea8e25e22cd (patch) | |
tree | 5b2a9edc9c7f62a035eed4baec6c48221b56ac38 /adb/fdevent.cpp | |
parent | d1f8e4dc9af2b309351bab70dc5eb5a10d939223 (diff) | |
download | system_core-6dfef255b8fa77e3b5c0a69b7f276ea8e25e22cd.tar.gz system_core-6dfef255b8fa77e3b5c0a69b7f276ea8e25e22cd.tar.bz2 system_core-6dfef255b8fa77e3b5c0a69b7f276ea8e25e22cd.zip |
adb: keep file flags in fdevent_install.
Bug: 24615098
Change-Id: Ia791ecbe612f09aca3bbd5787513f121fae54da5
Diffstat (limited to 'adb/fdevent.cpp')
-rw-r--r-- | adb/fdevent.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp index 1ccee9be9..18b64f6ec 100644 --- a/adb/fdevent.cpp +++ b/adb/fdevent.cpp @@ -36,6 +36,7 @@ #include "adb_io.h" #include "adb_trace.h" +#include "adb_utils.h" #if !ADB_HOST // This socket is used when a subproc shell service exists. @@ -124,11 +125,11 @@ void fdevent_install(fdevent* fde, int fd, fd_func func, void* arg) { fde->fd = fd; fde->func = func; fde->arg = arg; - if (fcntl(fd, F_SETFL, O_NONBLOCK) != 0) { + if (!set_file_block_mode(fd, false)) { // Here is not proper to handle the error. If it fails here, some error is // likely to be detected by poll(), then we can let the callback function // to handle it. - LOG(ERROR) << "failed to fcntl(" << fd << ") to be nonblock"; + LOG(ERROR) << "failed to set non-blocking mode for fd " << fd; } auto pair = g_poll_node_map.emplace(fde->fd, PollNode(fde)); CHECK(pair.second) << "install existing fd " << fd; |