From 15915b14150e34bc14d0eb1ace0330129f4c9f8e Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Fri, 16 Dec 2016 08:13:07 -0800 Subject: [PATCH] test_vendor: Use pipe2 to set pipe flags Simplify the code to fix a typo. F_SETFD should have been F_SETFL. Test: run unit tests out/host/linux-x86/nativetest/test-vendor_test_host/test-vendor_test_host \ --gtest_filter=AsyncManagerSocketTest.* Change-Id: I215381d6e130428acae7d73d80fefc97cbf64651 --- vendor_libs/test_vendor_lib/src/async_manager.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vendor_libs/test_vendor_lib/src/async_manager.cc b/vendor_libs/test_vendor_lib/src/async_manager.cc index 413455170..bf0114b89 100644 --- a/vendor_libs/test_vendor_lib/src/async_manager.cc +++ b/vendor_libs/test_vendor_lib/src/async_manager.cc @@ -159,7 +159,7 @@ class AsyncManager::AsyncFdWatcher { } // set up the communication channel int pipe_fds[2]; - if (pipe(pipe_fds)) { + if (pipe2(pipe_fds, O_NONBLOCK)) { LOG_ERROR(LOG_TAG, "%s:Unable to establish a communication channel to the reading " "thread", @@ -168,8 +168,6 @@ class AsyncManager::AsyncFdWatcher { } notification_listen_fd_ = pipe_fds[0]; notification_write_fd_ = pipe_fds[1]; - TEMP_FAILURE_RETRY(fcntl(notification_listen_fd_, F_SETFD, O_NONBLOCK)); - TEMP_FAILURE_RETRY(fcntl(notification_write_fd_, F_SETFD, O_NONBLOCK)); thread_ = std::thread([this]() { ThreadRoutine(); }); if (!thread_.joinable()) { -- 2.11.0