| Index: mojo/edk/system/channel.cc
|
| diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc
|
| index a03668ba1af72f281f72889555ddc4a104c8f35c..c8d693176c917620207a73335d47f7634eb1aab3 100644
|
| --- a/mojo/edk/system/channel.cc
|
| +++ b/mojo/edk/system/channel.cc
|
| @@ -336,10 +336,17 @@ bool Channel::Message::RewriteHandles(base::ProcessHandle from_process,
|
| from_process, handles[i].handle, to_process,
|
| &handles[i].handle, 0, FALSE,
|
| DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
| - if (result)
|
| + if (result) {
|
| handles[i].owning_process = to_process;
|
| - else
|
| + } else {
|
| success = false;
|
| +
|
| + // If handle duplication fails, the source handle will already be closed
|
| + // due to DUPLICATE_CLOSE_SOURCE. Replace the handle in the message with
|
| + // an invalid handle.
|
| + handles[i].handle = INVALID_HANDLE_VALUE;
|
| + handles[i].owning_process = base::GetCurrentProcessHandle();
|
| + }
|
| }
|
| return success;
|
| }
|
|
|