adb: keep file flags in fdevent_install.
Bug: 24615098
Change-Id: Ia791ecbe612f09aca3bbd5787513f121fae54da5
diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp
index 1ccee9b..18b64f6 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 @@
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;