diff options
| author | achan1989 <achan1989@gmail.com> | 2024-10-06 09:47:12 +0100 |
|---|---|---|
| committer | achan1989 <achan1989@gmail.com> | 2024-10-06 09:47:12 +0100 |
| commit | b01a5c6bb76c2a932efa2f99447dd31367ce8510 (patch) | |
| tree | a5fc9f748027cfb14082b9cfa8d64edc3b79e5d7 /lib/std | |
| parent | 1d8844dd5653d6496cbedbf75bdf8d367c16f690 (diff) | |
| download | zig-b01a5c6bb76c2a932efa2f99447dd31367ce8510.tar.gz zig-b01a5c6bb76c2a932efa2f99447dd31367ce8510.zip | |
Explain why POLL_FD_READWRITE is not dangerous at sites of use
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/fs/Dir.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/std/fs/Dir.zig b/lib/std/fs/Dir.zig index 2f946e92f7..d504ecb0c4 100644 --- a/lib/std/fs/Dir.zig +++ b/lib/std/fs/Dir.zig @@ -804,6 +804,8 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope } if (native_os == .wasi and !builtin.link_libc) { var base: std.os.wasi.rights_t = .{}; + // POLL_FD_READWRITE only grants extra rights if the corresponding FD_READ and/or FD_WRITE + // is also set. if (flags.isRead()) { base.FD_READ = true; base.FD_TELL = true; @@ -984,6 +986,8 @@ pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File .FD_FILESTAT_SET_TIMES = true, .FD_FILESTAT_SET_SIZE = true, .FD_FILESTAT_GET = true, + // POLL_FD_READWRITE only grants extra rights if the corresponding FD_READ and/or + // FD_WRITE is also set. .POLL_FD_READWRITE = true, }, .{}), }; |
