Initial upload to Gitea

This commit is contained in:
antonn committed 2026-11-30 16:32:37 +00:00
1 parent 78193254ad
commit 8478998cae
1485 files changed
+461025 -42348

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
//go:build !windows
package main
import (
"syscall"
"testing"
)
// openNoFollow centralizes the O_NOFOLLOW flag used by every safeOpen*/
// safeWrite* containment open in main.go (see opennofollow.go /
// opennofollow_windows.go). The windows stub is a build-tag typo away from
// winning on a unix build, which would silently turn the flag into 0 and make
// every open follow a planted symlink's final component again - this pins the
// unix contract. (The windows side cannot be pinned here: the constant is 0
// there by design, and the windows compile itself is verified by
// GOOS=windows go build.)
func TestOpenNoFollowIsRealOnUnixBuilds(t *testing.T) {
if openNoFollow != syscall.O_NOFOLLOW {
t.Fatalf("openNoFollow = %d, want syscall.O_NOFOLLOW (%d) on this platform", openNoFollow, syscall.O_NOFOLLOW)
}
if openNoFollow == 0 {
t.Fatal("openNoFollow is 0: the windows stub leaked into a build where syscall defines O_NOFOLLOW")
}
}