Loading adb/adb_unique_fd.h +7 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include <errno.h> #include <unistd.h> #include <unistd.h> #include <android-base/unique_fd.h> #include <android-base/unique_fd.h> Loading Loading @@ -48,14 +49,18 @@ inline bool Pipe(unique_fd* read, unique_fd* write, int flags = 0) { if (flags & O_CLOEXEC) { if (flags & O_CLOEXEC) { if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { PLOG(FATAL) << "failed to set FD_CLOEXEC on newly created pipe"; close(pipefd[0]); close(pipefd[1]); return false; } } } } if (flags & O_NONBLOCK) { if (flags & O_NONBLOCK) { if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { PLOG(FATAL) << "failed to set O_NONBLOCK on newly created pipe"; close(pipefd[0]); close(pipefd[1]); return false; } } } } #endif #endif Loading Loading
adb/adb_unique_fd.h +7 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include <errno.h> #include <unistd.h> #include <unistd.h> #include <android-base/unique_fd.h> #include <android-base/unique_fd.h> Loading Loading @@ -48,14 +49,18 @@ inline bool Pipe(unique_fd* read, unique_fd* write, int flags = 0) { if (flags & O_CLOEXEC) { if (flags & O_CLOEXEC) { if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { PLOG(FATAL) << "failed to set FD_CLOEXEC on newly created pipe"; close(pipefd[0]); close(pipefd[1]); return false; } } } } if (flags & O_NONBLOCK) { if (flags & O_NONBLOCK) { if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { PLOG(FATAL) << "failed to set O_NONBLOCK on newly created pipe"; close(pipefd[0]); close(pipefd[1]); return false; } } } } #endif #endif Loading