system/corennnnn
Revisión | 22cbf6260211971f8ef986fd252d70c66c184103 (tree) |
---|---|
Tiempo | 2016-06-23 10:08:03 |
Autor | Josh Gao <jmgao@goog...> |
Commiter | android-build-merger |
adb: don\'t dup local socket fd.
am: 42afe2033f
Change-Id: I4499180c294a79a12d7bcacbc3d41466037570f0
@@ -155,7 +155,7 @@ class Subprocess { | ||
155 | 155 | |
156 | 156 | const std::string& command() const { return command_; } |
157 | 157 | |
158 | - int local_socket_fd() const { return local_socket_sfd_.fd(); } | |
158 | + int ReleaseLocalSocket() { return local_socket_sfd_.Release(); } | |
159 | 159 | |
160 | 160 | pid_t pid() const { return pid_; } |
161 | 161 |
@@ -450,7 +450,7 @@ void Subprocess::ThreadHandler(void* userdata) { | ||
450 | 450 | Subprocess* subprocess = reinterpret_cast<Subprocess*>(userdata); |
451 | 451 | |
452 | 452 | adb_thread_setname(android::base::StringPrintf( |
453 | - "shell srvc %d", subprocess->local_socket_fd())); | |
453 | + "shell srvc %d", subprocess->pid())); | |
454 | 454 | |
455 | 455 | D("passing data streams for PID %d", subprocess->pid()); |
456 | 456 | subprocess->PassDataStreams(); |
@@ -761,14 +761,13 @@ int StartSubprocess(const char* name, const char* terminal_type, | ||
761 | 761 | return ReportError(protocol, error); |
762 | 762 | } |
763 | 763 | |
764 | - unique_fd local_socket(dup(subprocess->local_socket_fd())); | |
765 | - D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket.get(), | |
766 | - subprocess->pid()); | |
764 | + int local_socket = subprocess->ReleaseLocalSocket(); | |
765 | + D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket, subprocess->pid()); | |
767 | 766 | |
768 | 767 | if (!Subprocess::StartThread(std::move(subprocess), &error)) { |
769 | 768 | LOG(ERROR) << "failed to start subprocess management thread: " << error; |
770 | 769 | return ReportError(protocol, error); |
771 | 770 | } |
772 | 771 | |
773 | - return local_socket.release(); | |
772 | + return local_socket; | |
774 | 773 | } |