From eb0c4726f13d06662b0cf82571e5047b386d6dae Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Thu, 3 Oct 2019 10:25:00 -0700 Subject: [PATCH] linux: make GetHandlerSocket() params optional It turns out it's frequently convenient to only grab one of these at a time. Change-Id: Ie4a05583a5c875163154efc485d57a014101cc16 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1838011 Reviewed-by: Mark Mentovai Commit-Queue: Joshua Peraza --- client/crashpad_client.h | 4 ++-- client/crashpad_client_linux.cc | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/crashpad_client.h b/client/crashpad_client.h index dfe13538..207f9784 100644 --- a/client/crashpad_client.h +++ b/client/crashpad_client.h @@ -124,8 +124,8 @@ class CrashpadClient { //! `StartHandler()` must have successfully been called before calling this //! method. //! - //! \param[out] sock The socket connected to the handler. - //! \param[out] pid The handler's process ID. + //! \param[out] sock The socket connected to the handler, if not `nullptr`. + //! \param[out] pid The handler's process ID, if not `nullptr`. //! \return `true` on success. Otherwise `false` with a message logged. static bool GetHandlerSocket(int* sock, pid_t* pid); diff --git a/client/crashpad_client_linux.cc b/client/crashpad_client_linux.cc index f1368ec7..74f15403 100644 --- a/client/crashpad_client_linux.cc +++ b/client/crashpad_client_linux.cc @@ -295,8 +295,12 @@ class RequestCrashDumpHandler : public SignalHandler { if (!sock_to_handler_.is_valid()) { return false; } - *sock = sock_to_handler_.get(); - *pid = handler_pid_; + if (sock) { + *sock = sock_to_handler_.get(); + } + if (pid) { + *pid = handler_pid_; + } return true; }