// Copyright (c) 2026 Petr BalvĂ­n (https://petrbalvin.org) // SPDX-License-Identifier: MIT //go:build freebsd || netbsd || openbsd || darwin package nfsfs import ( "errors" "syscall" ) // symlinkRefused reports whether an open refused a final component that is // a symlink, the answer O_NOFOLLOW exists for. The systems disagree on the // answer: FreeBSD and OpenBSD answer EMLINK, NetBSD answers EFTYPE, darwin // names EMLINK in its open(2), and the ELOOP spelling stays in the check // for the lineage it came from. FreeBSD, OpenBSD and NetBSD are verified // live; the darwin answer rests on its manual. func symlinkRefused(err error) bool { return errors.Is(err, syscall.ELOOP) || errors.Is(err, syscall.EMLINK) || errors.Is(err, syscall.EFTYPE) }