diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-12-19 17:29:26 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-12-23 22:15:11 -0800 |
| commit | e41342af83022202c6e413cd84c12b41f19c681a (patch) | |
| tree | 622264e2ef6a094923e7adb290ec717af90d644c /lib/std/Thread.zig | |
| parent | 64de4a7371e3851dddf39c608d08d480395bb0ab (diff) | |
| download | zig-e41342af83022202c6e413cd84c12b41f19c681a.tar.gz zig-e41342af83022202c6e413cd84c12b41f19c681a.zip | |
std.Io.Threaded: reinstate fchmodat fallback
Stephen Gregoratto (original author of the fallback) says:
I read through both libcs again to compare:
Musl:
- `stat` path. Check error.
- If path is a symlink, return `OPNOTSUPP`.
- `openat` path as `O_PATH|O_NOFOLLOW|O_CLOEXEC`. Return `OPNOTSUPP` if we got `ELOOP`.
- Build procfs filename.
- `stat` procfs file.
- If procfs file is a symlink, return `OPNOTSUPP`.
- close path fd.
Glibc:
- open path as `O_PATH|O_NOFOLLOW|O_CLOEXEC`.
- fstatat path fd.
- If path is a symlink, return `OPNOTSUPP`.
- Build procfs filename.
- chmod procfs filename. Return `OPNOTSUPP` if we got `ENOENT`.
- close path fd.
I prefer glibc since you open the path first, which avoids a possible
TOCTOU race.
Diffstat (limited to 'lib/std/Thread.zig')
0 files changed, 0 insertions, 0 deletions
