[syscalls] Update zx_channel_write clients
zx_channel_write now always consumes handles.
Test: No behavior change
Change-Id: I9467358b16710335cc9805c7f90deed35de7f836
diff --git a/lib/magma/src/magma_util/platform/zircon/zircon_platform_connection.cc b/lib/magma/src/magma_util/platform/zircon/zircon_platform_connection.cc
index 2c2f5f6..6375da5 100644
--- a/lib/magma/src/magma_util/platform/zircon/zircon_platform_connection.cc
+++ b/lib/magma/src/magma_util/platform/zircon/zircon_platform_connection.cc
@@ -599,7 +599,6 @@
ImportBufferOp op;
magma_status_t result = channel_write(&op, sizeof(op), &duplicate_handle_zx, 1);
if (result != MAGMA_STATUS_OK) {
- zx_handle_close(duplicate_handle);
return DRET_MSG(result, "failed to write to channel");
}
@@ -628,7 +627,6 @@
magma_status_t result = channel_write(&op, sizeof(op), &duplicate_handle_zx, 1);
if (result != MAGMA_STATUS_OK) {
- zx_handle_close(handle);
return DRET_MSG(result, "failed to write to channel");
}
@@ -678,7 +676,6 @@
zx_handle_t duplicate_handle_zx = command_buffer_handle;
magma_status_t result = channel_write(&op, sizeof(op), &duplicate_handle_zx, 1);
if (result != MAGMA_STATUS_OK) {
- zx_handle_close(command_buffer_handle);
SetError(result);
}
}
diff --git a/public/rust/crates/fuchsia-zircon/src/channel.rs b/public/rust/crates/fuchsia-zircon/src/channel.rs
index 22ef87e..b6b2dfd 100644
--- a/public/rust/crates/fuchsia-zircon/src/channel.rs
+++ b/public/rust/crates/fuchsia-zircon/src/channel.rs
@@ -97,9 +97,9 @@
unsafe {
let status = sys::zx_channel_write(self.raw_handle(), opts, bytes.as_ptr(), n_bytes,
handles.as_ptr() as *const sys::zx_handle_t, n_handles);
- ok(status)?;
- // Handles were successfully transferred, forget them on sender side
+ // Handles are always consumed, forget them on sender side
handles.set_len(0);
+ ok(status)?;
Ok(())
}
}