-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right now we open directories using O_RDONLY. This is problematic, because it means we can't perform operations on directories that only have execute permissions. The solution for this is to use O_SEARCH, which was added in POSIX 2008. Linux doesn't offer O_SEARCH, but we can emulate it using O_PATH. macOS has supported this feature since Ventura (October 2022).
- Loading branch information
1 parent
f5a181e
commit b263fc6
Showing
6 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git unix/zerrors_darwin_amd64.go unix/zerrors_darwin_amd64.go | ||
index d73c465..d406964 100644 | ||
--- unix/zerrors_darwin_amd64.go | ||
+++ unix/zerrors_darwin_amd64.go | ||
@@ -1128,6 +1128,7 @@ const ( | ||
O_DSYNC = 0x400000 | ||
O_EVTONLY = 0x8000 | ||
O_EXCL = 0x800 | ||
+ O_EXEC = 0x40000000 | ||
O_EXLOCK = 0x20 | ||
O_FSYNC = 0x80 | ||
O_NDELAY = 0x4 | ||
@@ -1138,6 +1139,7 @@ const ( | ||
O_POPUP = 0x80000000 | ||
O_RDONLY = 0x0 | ||
O_RDWR = 0x2 | ||
+ O_SEARCH = 0x40100000 | ||
O_SHLOCK = 0x10 | ||
O_SYMLINK = 0x200000 | ||
O_SYNC = 0x80 | ||
diff --git unix/zerrors_darwin_arm64.go unix/zerrors_darwin_arm64.go | ||
index 4a55a40..c47c6e9 100644 | ||
--- unix/zerrors_darwin_arm64.go | ||
+++ unix/zerrors_darwin_arm64.go | ||
@@ -1128,6 +1128,7 @@ const ( | ||
O_DSYNC = 0x400000 | ||
O_EVTONLY = 0x8000 | ||
O_EXCL = 0x800 | ||
+ O_EXEC = 0x40000000 | ||
O_EXLOCK = 0x20 | ||
O_FSYNC = 0x80 | ||
O_NDELAY = 0x4 | ||
@@ -1138,6 +1139,7 @@ const ( | ||
O_POPUP = 0x80000000 | ||
O_RDONLY = 0x0 | ||
O_RDWR = 0x2 | ||
+ O_SEARCH = 0x40100000 | ||
O_SHLOCK = 0x10 | ||
O_SYMLINK = 0x200000 | ||
O_SYNC = 0x80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters