diff options
author | Josh Gao | 2018-05-24 12:34:41 -0500 |
---|---|---|
committer | Gerrit Code Review | 2018-05-24 12:34:41 -0500 |
commit | 925b410c7f65f88f9483c68bfbdec64c31b92570 (patch) | |
tree | 5cbf61d3d7bfc242d4afa564b89464d9a4eaaaa0 | |
parent | 05063a8715fd3483abcdd842eebff744582673d9 (diff) | |
parent | 99c27d3e99cb9524b63f02c3c4b1204daa5929d9 (diff) | |
download | platform-system-core-925b410c7f65f88f9483c68bfbdec64c31b92570.tar.gz platform-system-core-925b410c7f65f88f9483c68bfbdec64c31b92570.tar.xz platform-system-core-925b410c7f65f88f9483c68bfbdec64c31b92570.zip |
Merge "adb: fix mac build."
-rw-r--r-- | adb/adb_unique_fd.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/adb/adb_unique_fd.h b/adb/adb_unique_fd.h index 7d2354d0e..d1dc9d10e 100644 --- a/adb/adb_unique_fd.h +++ b/adb/adb_unique_fd.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #pragma once | 17 | #pragma once |
18 | 18 | ||
19 | #include <errno.h> | ||
19 | #include <unistd.h> | 20 | #include <unistd.h> |
20 | 21 | ||
21 | #include <android-base/unique_fd.h> | 22 | #include <android-base/unique_fd.h> |
@@ -48,14 +49,18 @@ inline bool Pipe(unique_fd* read, unique_fd* write, int flags = 0) { | |||
48 | if (flags & O_CLOEXEC) { | 49 | if (flags & O_CLOEXEC) { |
49 | if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || | 50 | if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || |
50 | fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { | 51 | fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { |
51 | PLOG(FATAL) << "failed to set FD_CLOEXEC on newly created pipe"; | 52 | close(pipefd[0]); |
53 | close(pipefd[1]); | ||
54 | return false; | ||
52 | } | 55 | } |
53 | } | 56 | } |
54 | 57 | ||
55 | if (flags & O_NONBLOCK) { | 58 | if (flags & O_NONBLOCK) { |
56 | if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || | 59 | if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || |
57 | fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { | 60 | fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { |
58 | PLOG(FATAL) << "failed to set O_NONBLOCK on newly created pipe"; | 61 | close(pipefd[0]); |
62 | close(pipefd[1]); | ||
63 | return false; | ||
59 | } | 64 | } |
60 | } | 65 | } |
61 | #endif | 66 | #endif |