authorgravatar for achan1989@gmail.comachan1989 <achan1989@gmail.com> 2024-10-06 09:47:12+01:00
committergravatar for achan1989@gmail.comachan1989 <achan1989@gmail.com> 2024-10-06 09:47:12+01:00
logb01a5c6bb76c2a932efa2f99447dd31367ce8510
treea5fc9f748027cfb14082b9cfa8d64edc3b79e5d7
parent1d8844dd5653d6496cbedbf75bdf8d367c16f690

Explain why POLL_FD_READWRITE is not dangerous at sites of use


1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/fs/Dir.zig+4
......@@ -804,6 +804,8 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
804804 }
805805 if (native_os == .wasi and !builtin.link_libc) {
806806 var base: std.os.wasi.rights_t = .{};
807 // POLL_FD_READWRITE only grants extra rights if the corresponding FD_READ and/or FD_WRITE
808 // is also set.
807809 if (flags.isRead()) {
808810 base.FD_READ = true;
809811 base.FD_TELL = true;
......@@ -984,6 +986,8 @@ pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File
984986 .FD_FILESTAT_SET_TIMES = true,
985987 .FD_FILESTAT_SET_SIZE = true,
986988 .FD_FILESTAT_GET = true,
989 // POLL_FD_READWRITE only grants extra rights if the corresponding FD_READ and/or
990 // FD_WRITE is also set.
987991 .POLL_FD_READWRITE = true,
988992 }, .{}),
989993 };