Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: client/crashpad_client_mac.cc

Issue 1408473002: ChildPortHandshake: allow receive rights to be received (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | handler/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crashpad_client_mac.cc
diff --git a/client/crashpad_client_mac.cc b/client/crashpad_client_mac.cc
index 5797fba8ba297574efe50e75932659a684431366..b95c07aa058bb3d4364520399f698331b74e631e 100644
--- a/client/crashpad_client_mac.cc
+++ b/client/crashpad_client_mac.cc
@@ -97,7 +97,7 @@ bool CrashpadClient::StartHandler(
// Set up the arguments for execve() first. These aren’t needed until execve()
// is called, but it’s dangerous to do this in a child process after fork().
ChildPortHandshake child_port_handshake;
- int handshake_fd = child_port_handshake.ReadPipeFD();
+ base::ScopedFD client_read_fd = child_port_handshake.ClientReadFD();
// Use handler as argv[0], followed by arguments directed by this method’s
// parameters and a --handshake-fd argument. |arguments| are added first so
@@ -119,7 +119,7 @@ bool CrashpadClient::StartHandler(
argv.push_back(
FormatArgumentString("annotation", kv.first + '=' + kv.second));
}
- argv.push_back(FormatArgumentInt("handshake-fd", handshake_fd));
+ argv.push_back(FormatArgumentInt("handshake-fd", client_read_fd.get()));
// argv_c contains const char* pointers and is terminated by nullptr. argv
// is required because the pointers in argv_c need to point somewhere, and
@@ -181,7 +181,7 @@ bool CrashpadClient::StartHandler(
// Grandchild process.
- CloseMultipleNowOrOnExec(STDERR_FILENO + 1, handshake_fd);
+ CloseMultipleNowOrOnExec(STDERR_FILENO + 1, client_read_fd.get());
// &argv_c[0] is a pointer to a pointer to const char data, but because of
// how C (not C++) works, execvp() wants a pointer to a const pointer to
@@ -193,6 +193,8 @@ bool CrashpadClient::StartHandler(
// Parent process.
+ client_read_fd.reset();
+
// waitpid() for the child, so that it does not become a zombie process. The
// child normally exits quickly.
int status;
@@ -209,7 +211,8 @@ bool CrashpadClient::StartHandler(
}
// Rendezvous with the handler running in the grandchild process.
- exception_port_.reset(child_port_handshake.RunServer());
+ exception_port_.reset(child_port_handshake.RunServer(
+ ChildPortHandshake::PortRightType::kSendRight));
return exception_port_.is_valid();
}
« no previous file with comments | « no previous file | handler/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698