Darwin has no syscall.FcntlInt, so main did not build on a Mac

The descriptor-passing change reached for syscall.FcntlInt, which exists in
x/sys/unix and not in Darwin's syscall package, so every build on a Mac has
failed since it landed. The last tag builds; main does not, which is the shape
that gets noticed late.

x/sys/unix is already required, so this adds nothing but the import.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-09-10 16:08:05 -07:00
co-authored by Hanzo Dev
parent 264d3c2578
commit ff3a1fd218
+8 -2
View File
@@ -5,7 +5,8 @@ package zip
import ( import (
"os" "os"
"runtime" "runtime"
"syscall"
"golang.org/x/sys/unix"
) )
// recvFlags carries no MSG_CMSG_CLOEXEC because Darwin has none. The flag is // recvFlags carries no MSG_CMSG_CLOEXEC because Darwin has none. The flag is
@@ -15,8 +16,13 @@ import (
const recvFlags = 0 const recvFlags = 0
// setCloexec marks a received descriptor close-on-exec. // setCloexec marks a received descriptor close-on-exec.
//
// Through x/sys/unix rather than syscall: FcntlInt is not in Darwin's syscall
// package, so the file this replaces did not compile on a Mac at all — main has
// been unbuildable there since the descriptor-passing change landed, while the
// last tag builds. unix is already a dependency, so this adds nothing.
func setCloexec(fd int) { func setCloexec(fd int) {
_, _ = syscall.FcntlInt(uintptr(fd), syscall.F_SETFD, syscall.FD_CLOEXEC) _, _ = unix.FcntlInt(uintptr(fd), unix.F_SETFD, unix.FD_CLOEXEC)
} }
// runtimeKeepFiles holds the files alive until the syscall has copied them. // runtimeKeepFiles holds the files alive until the syscall has copied them.