Commit 0d85284e4d

achan1989 <achan1989@gmail.com>
2024-10-04 23:13:33
Create/open file on WASI targets should have POLL_FD_READWRITE rights
1 parent d23db94
Changed files (1)
lib
std
lib/std/fs/Dir.zig
@@ -809,6 +809,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
             base.FD_TELL = true;
             base.FD_SEEK = true;
             base.FD_FILESTAT_GET = true;
+            base.POLL_FD_READWRITE = true;
         }
         if (flags.isWrite()) {
             base.FD_WRITE = true;
@@ -821,6 +822,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
             base.FD_ADVISE = true;
             base.FD_FILESTAT_SET_TIMES = true;
             base.FD_FILESTAT_SET_SIZE = true;
+            base.POLL_FD_READWRITE = true;
         }
         const fd = try posix.openatWasi(self.fd, sub_path, .{}, .{}, .{}, base, .{});
         return .{ .handle = fd };
@@ -982,6 +984,7 @@ 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 = true,
             }, .{}),
         };
     }