Index: ipc/ipc_platform_file.cc |
diff --git a/ipc/ipc_platform_file.cc b/ipc/ipc_platform_file.cc |
index a9b7b880932e3c2dd4d5ca7b627c1d77764faf6f..c8fde86f1e4564403290da39c2abf6cb880e48bc 100644 |
--- a/ipc/ipc_platform_file.cc |
+++ b/ipc/ipc_platform_file.cc |
@@ -14,21 +14,21 @@ namespace IPC { |
PlatformFileForTransit GetFileHandleForProcess(base::PlatformFile handle, |
base::ProcessHandle process, |
bool close_source_handle) { |
- IPC::PlatformFileForTransit out_handle; |
#if defined(OS_WIN) |
HANDLE raw_handle = INVALID_HANDLE_VALUE; |
DWORD options = DUPLICATE_SAME_ACCESS; |
if (close_source_handle) |
options |= DUPLICATE_CLOSE_SOURCE; |
if (handle == INVALID_HANDLE_VALUE || |
- !::DuplicateHandle(::GetCurrentProcess(), handle, process, &raw_handle, 0, |
- FALSE, options)) { |
- out_handle = IPC::InvalidPlatformFileForTransit(); |
- } else { |
- out_handle = |
- IPC::PlatformFileForTransit(raw_handle, base::GetProcId(process)); |
- out_handle.SetOwnershipPassesToIPC(true); |
+ !::DuplicateHandle(::GetCurrentProcess(), handle, ::GetCurrentProcess(), |
+ &raw_handle, 0, FALSE, options)) { |
+ return IPC::InvalidPlatformFileForTransit(); |
} |
+ |
+ IPC::PlatformFileForTransit out_handle = IPC::PlatformFileForTransit( |
+ raw_handle, base::GetCurrentProcId()); |
+ out_handle.SetOwnershipPassesToIPC(true); |
+ return out_handle; |
#elif defined(OS_POSIX) |
// If asked to close the source, we can simply re-use the source fd instead of |
// dup()ing and close()ing. |
@@ -39,11 +39,10 @@ PlatformFileForTransit GetFileHandleForProcess(base::PlatformFile handle, |
// close the source handle before the message is sent, creating a race |
// condition. |
int fd = close_source_handle ? handle : ::dup(handle); |
- out_handle = base::FileDescriptor(fd, true); |
+ return base::FileDescriptor(fd, true); |
#else |
#error Not implemented. |
#endif |
- return out_handle; |
} |
PlatformFileForTransit TakeFileHandleForProcess(base::File file, |