From bd036acda642174bc322eee9471d5f7a4d27ece7 Mon Sep 17 00:00:00 2001 From: Daniel Loffgren Date: Tue, 20 Dec 2022 12:56:45 -0800 Subject: [PATCH] Storage should be initialized to MACH_PORT_NULL, rather than 0 --- Sources/System/MachPort.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/System/MachPort.swift b/Sources/System/MachPort.swift index bc89663..be02c98 100644 --- a/Sources/System/MachPort.swift +++ b/Sources/System/MachPort.swift @@ -145,7 +145,7 @@ extension Mach.Port where RightType == Mach.ReceiveRight { /// This initializer will abort if the right could not be created. /// Callers may assert that a valid right is always returned. init() { - var storage: mach_port_name_t = 0 + var storage: mach_port_name_t = mach_port_name_t(MACH_PORT_NULL) withUnsafeMutablePointer(to: &storage) { storage in machPrecondition(mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, storage)) }