Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Containerization/UnixSocketRelay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ extension SocketRelay {
"dstFd": "\(destinationFd)",
])
source.cancel()
if shutdown(destinationFd, SHUT_WR) != 0 {
if shutdown(destinationFd, Int32(SHUT_WR)) != 0 {
log?.warning(
"failed to shut down reads",
metadata: [
Expand Down Expand Up @@ -429,7 +429,7 @@ extension SocketRelay {
log?.error("file descriptor copy failed \(error)")
if !source.isCancelled {
source.cancel()
if shutdown(destinationFd, SHUT_RDWR) != 0 {
if shutdown(destinationFd, Int32(SHUT_RDWR)) != 0 {
log?.warning(
"failed to shut down destination after I/O error",
metadata: [
Expand Down
5 changes: 5 additions & 0 deletions Sources/ContainerizationOS/Socket/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,12 @@ extension Socket {

var cmsgBuf = [UInt8](repeating: 0, count: Int(CZ_CMSG_SPACE(Int(MemoryLayout<Int32>.size))))
msg.msg_control = withUnsafeMutablePointer(to: &cmsgBuf[0]) { UnsafeMutableRawPointer($0) }

#if canImport(Glibc)
msg.msg_controllen = size_t(cmsgBuf.count)
#else
msg.msg_controllen = socklen_t(cmsgBuf.count)
#endif

let recvResult = withUnsafeMutablePointer(to: &msg) { msgPtr in
sysRecvmsg(handle.fileDescriptor, msgPtr, 0)
Expand Down