Merge changes Ia59c6dbe,I13b17bcd
* changes: adb: fix fd leak when shell fails to create a thread. adb: don't dup local socket fd.
This commit is contained in:
commit
0b47d08303
|
@ -155,7 +155,7 @@ class Subprocess {
|
|||
|
||||
const std::string& command() const { return command_; }
|
||||
|
||||
int local_socket_fd() const { return local_socket_sfd_; }
|
||||
int ReleaseLocalSocket() { return local_socket_sfd_.release(); }
|
||||
|
||||
pid_t pid() const { return pid_; }
|
||||
|
||||
|
@ -449,7 +449,7 @@ void Subprocess::ThreadHandler(void* userdata) {
|
|||
Subprocess* subprocess = reinterpret_cast<Subprocess*>(userdata);
|
||||
|
||||
adb_thread_setname(android::base::StringPrintf(
|
||||
"shell srvc %d", subprocess->local_socket_fd()));
|
||||
"shell srvc %d", subprocess->pid()));
|
||||
|
||||
D("passing data streams for PID %d", subprocess->pid());
|
||||
subprocess->PassDataStreams();
|
||||
|
@ -756,7 +756,7 @@ int StartSubprocess(const char* name, const char* terminal_type,
|
|||
return ReportError(protocol, error);
|
||||
}
|
||||
|
||||
unique_fd local_socket(dup(subprocess->local_socket_fd()));
|
||||
unique_fd local_socket(subprocess->ReleaseLocalSocket());
|
||||
D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket.get(),
|
||||
subprocess->pid());
|
||||
|
||||
|
|
Loading…
Reference in New Issue