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

Unified Diff: third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc

Issue 1040163002: RawChannelPosix: Close handles only if they are sent successfully. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
diff --git a/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc b/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
index d8c55d56b1b2bb3ef2b3f45c0ed53a60fdbeabe0..c2b2ef0730cee09d952f7461a2e1b55535ef7955 100644
--- a/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
+++ b/third_party/mojo/src/mojo/edk/system/raw_channel_posix.cc
@@ -244,8 +244,10 @@ RawChannel::IOResult RawChannelPosix::WriteNoLock(
write_result = embedder::PlatformChannelSendmsgWithHandles(
fd_.get(), iov, buffer_count, platform_handles, num_platform_handles);
- for (size_t i = 0; i < num_platform_handles; i++)
- platform_handles[i].CloseIfNecessary();
+ if (write_result >= 0) {
+ for (size_t i = 0; i < num_platform_handles; i++)
+ platform_handles[i].CloseIfNecessary();
+ }
} else {
std::vector<WriteBuffer::Buffer> buffers;
write_buffer_no_lock()->GetBuffers(&buffers);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698