| ... | ... | @@ -2253,6 +2253,7 @@ const dirOpenDir = switch (native_os) { |
| 2253 | 2253 | else => dirOpenDirPosix, |
| 2254 | 2254 | }; |
| 2255 | 2255 | |
| 2256 | /// This function is also used for WASI when libc is linked. |
| 2256 | 2257 | fn dirOpenDirPosix( |
| 2257 | 2258 | userdata: ?*anyopaque, |
| 2258 | 2259 | dir: Io.Dir, |
| ... | ... | @@ -2551,7 +2552,10 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8) Io |
| 2551 | 2552 | .FAULT => |err| return errnoBug(err), |
| 2552 | 2553 | .SRCH => return error.ProcessNotFound, |
| 2553 | 2554 | .AGAIN => return error.WouldBlock, |
| 2554 | | .BADF => |err| return errnoBug(err), // File descriptor used after closed. |
| 2555 | .BADF => |err| { |
| 2556 | if (native_os == .wasi) return error.NotOpenForReading; // File operation on directory. |
| 2557 | return errnoBug(err); // File descriptor used after closed. |
| 2558 | }, |
| 2555 | 2559 | .IO => return error.InputOutput, |
| 2556 | 2560 | .ISDIR => return error.IsDir, |
| 2557 | 2561 | .NOBUFS => return error.SystemResources, |
| ... | ... | @@ -2648,7 +2652,10 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8, o |
| 2648 | 2652 | .FAULT => |err| return errnoBug(err), |
| 2649 | 2653 | .SRCH => return error.ProcessNotFound, |
| 2650 | 2654 | .AGAIN => return error.WouldBlock, |
| 2651 | | .BADF => |err| return errnoBug(err), // File descriptor used after closed. |
| 2655 | .BADF => |err| { |
| 2656 | if (native_os == .wasi) return error.NotOpenForReading; // File operation on directory. |
| 2657 | return errnoBug(err); // File descriptor used after closed. |
| 2658 | }, |
| 2652 | 2659 | .IO => return error.InputOutput, |
| 2653 | 2660 | .ISDIR => return error.IsDir, |
| 2654 | 2661 | .NOBUFS => return error.SystemResources, |