From 9acdf07bc83727858c219ef99791d3b0b1b18e10 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 27 Aug 2024 15:34:20 +1000 Subject: [PATCH] fix pointer indirection issue in Message were sending pointers, not values, on the wire --- Sources/IORing/Message.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/IORing/Message.swift b/Sources/IORing/Message.swift index ed94ddb..b969436 100644 --- a/Sources/IORing/Message.swift +++ b/Sources/IORing/Message.swift @@ -65,8 +65,8 @@ public final class Message: @unchecked Sendable { self.address = address self.buffer = buffer storage.msg_flags = CInt(flags) - Swift.withUnsafeMutablePointer(to: &self.buffer) { - iov_storage.iov_base = UnsafeMutableRawPointer(mutating: $0) + self.buffer.withUnsafeMutableBytes { + iov_storage.iov_base = UnsafeMutableRawPointer(mutating: $0.baseAddress) } iov_storage.iov_len = self.buffer.count Swift.withUnsafeMutablePointer(to: &self.address) { pointer in