| author | |
| committer | |
| log | b3dc1c380d3510a4c1d28286fe4d345c1e307d58 |
| tree | f9c7bf6615e58aacf297c241bf7599e56933a33c |
| parent | 13265cf7c785250fde12b22b5e748258d9b98afd |
| signature |
2 files changed, 8 insertions(+), 3 deletions(-)
std/c.zig+1| ... | ... | @@ -32,6 +32,7 @@ pub extern "c" fn abort() noreturn; |
| 32 | 32 | pub extern "c" fn exit(code: c_int) noreturn; |
| 33 | 33 | pub extern "c" fn isatty(fd: fd_t) c_int; |
| 34 | 34 | pub extern "c" fn close(fd: fd_t) c_int; |
| 35 | pub extern "c" fn @"close$NOCANCEL"(fd: fd_t) c_int; | |
| 35 | 36 | pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int; |
| 36 | 37 | pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int; |
| 37 | 38 | pub extern "c" fn lseek(fd: fd_t, offset: isize, whence: c_int) isize; |
std/os.zig+7-3| ... | ... | @@ -74,9 +74,13 @@ pub fn close(fd: fd_t) void { |
| 74 | 74 | return windows.CloseHandle(fd); |
| 75 | 75 | } |
| 76 | 76 | if (wasi.is_the_target) { |
| 77 | switch (wasi.fd_close(fd)) { | |
| 78 | 0 => return, | |
| 79 | else => |err| return unexpectedErrno(err), | |
| 77 | _ = wasi.fd_close(fd); | |
| 78 | } | |
| 79 | if (darwin.is_the_target) { | |
| 80 | // This avoids the EINTR problem. | |
| 81 | switch (darwin.getErrno(darwin.@"close$NOCANCEL"(fd))) { | |
| 82 | EBADF => unreachable, // Always a race condition. | |
| 83 | else => return, | |
| 80 | 84 | } |
| 81 | 85 | } |
| 82 | 86 | switch (errno(system.close(fd))) { |