mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
freebsd: fix std.c.getdents
- 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.
This commit is contained in:
parent
1253d591be
commit
64ddba955a
@ -75,7 +75,7 @@ pub const _errno = __error;
|
||||
|
||||
pub extern "c" var malloc_options: [*:0]const u8;
|
||||
|
||||
pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
|
||||
pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) isize;
|
||||
pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
|
||||
pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
|
||||
pub extern "c" fn getentropy(buf_ptr: [*]u8, buf_len: usize) c_int;
|
||||
|
||||
@ -478,6 +478,9 @@ pub const IterableDir = struct {
|
||||
.FAULT => unreachable,
|
||||
.NOTDIR => unreachable,
|
||||
.INVAL => unreachable,
|
||||
// Introduced in freebsd 13.2: directory unlinked but still open.
|
||||
// To be consistent, iteration ends if the directory being iterated is deleted during iteration.
|
||||
.NOENT => return null,
|
||||
else => |err| return os.unexpectedErrno(err),
|
||||
}
|
||||
if (rc == 0) return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user