diff options
author | Josh Gao <jmgao@google.com> | 2016-03-04 15:15:56 -0800 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2016-03-04 15:15:56 -0800 |
commit | f0d3b4fc11b35ce295bd698555579ed242473e69 (patch) | |
tree | 2164874d6cf2863e85f83654f543103447d84fd9 /adb/shell_service.cpp | |
parent | afa76a302803fb9f25478c177486c218d713bc19 (diff) | |
download | system_core-f0d3b4fc11b35ce295bd698555579ed242473e69.tar.gz system_core-f0d3b4fc11b35ce295bd698555579ed242473e69.tar.bz2 system_core-f0d3b4fc11b35ce295bd698555579ed242473e69.zip |
adb: make ScopedFd universally accessible and useful.
Change-Id: I707ffbd10958e7449b4c95dff48638480c746939
Diffstat (limited to 'adb/shell_service.cpp')
-rw-r--r-- | adb/shell_service.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp index f84447f5f..95fd49b74 100644 --- a/adb/shell_service.cpp +++ b/adb/shell_service.cpp @@ -135,37 +135,6 @@ std::string ReadAll(int fd) { return received; } -// Helper to automatically close an FD when it goes out of scope. -class ScopedFd { - public: - ScopedFd() {} - ~ScopedFd() { Reset(); } - - void Reset(int fd=-1) { - if (fd != fd_) { - if (valid()) { - adb_close(fd_); - } - fd_ = fd; - } - } - - int Release() { - int temp = fd_; - fd_ = -1; - return temp; - } - - bool valid() const { return fd_ >= 0; } - - int fd() const { return fd_; } - - private: - int fd_ = -1; - - DISALLOW_COPY_AND_ASSIGN(ScopedFd); -}; - // Creates a socketpair and saves the endpoints to |fd1| and |fd2|. bool CreateSocketpair(ScopedFd* fd1, ScopedFd* fd2) { int sockets[2]; |