| author | |
| committer | |
| log | 64ddba955a1f98ab77cfb39844a09f472ebc4609 |
| tree | cfa19a5d06fabf23feda0cae220c16a2c8512e9c |
| parent | 1253d591be2aeea49c0b67ce0416237060e78a57 |
| signature |
- fix getdents return type usize → isize
- usize ultimately forced errors to .SUCCESS in std.c.getError
New behavior in freebsd 13.2 is to return ENOENT if the directory being
iterated is deleted during iteration. We now detect this and treat it
consistent with iteration ending.2 files changed, 4 insertions(+), 1 deletions(-)
lib/std/c/freebsd.zig+1-1| ... | @@ -75,7 +75,7 @@ pub const _errno = __error; | ... | @@ -75,7 +75,7 @@ pub const _errno = __error; |
| 75 | 75 | ||
| 76 | pub extern "c" var malloc_options: [*:0]const u8; | 76 | pub extern "c" var malloc_options: [*:0]const u8; |
| 77 | 77 | ||
| 78 | pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; | 78 | pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) isize; |
| 79 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | 79 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
| 80 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; | 80 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; |
| 81 | pub extern "c" fn getentropy(buf_ptr: [*]u8, buf_len: usize) c_int; | 81 | pub extern "c" fn getentropy(buf_ptr: [*]u8, buf_len: usize) c_int; |
lib/std/fs.zig+3| ... | @@ -478,6 +478,9 @@ pub const IterableDir = struct { | ... | @@ -478,6 +478,9 @@ pub const IterableDir = struct { |
| 478 | .FAULT => unreachable, | 478 | .FAULT => unreachable, |
| 479 | .NOTDIR => unreachable, | 479 | .NOTDIR => unreachable, |
| 480 | .INVAL => unreachable, | 480 | .INVAL => unreachable, |
| 481 | // Introduced in freebsd 13.2: directory unlinked but still open. | ||
| 482 | // To be consistent, iteration ends if the directory being iterated is deleted during iteration. | ||
| 483 | .NOENT => return null, | ||
| 481 | else => |err| return os.unexpectedErrno(err), | 484 | else => |err| return os.unexpectedErrno(err), |
| 482 | } | 485 | } |
| 483 | if (rc == 0) return null; | 486 | if (rc == 0) return null; |