| ... | ... | @@ -352,7 +352,7 @@ pub const Dir = struct { |
| 352 | 352 | |
| 353 | 353 | const name = @ptrCast([*]u8, &darwin_entry.d_name)[0..darwin_entry.d_namlen]; |
| 354 | 354 | |
| 355 | | if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) { |
| 355 | if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..") or (darwin_entry.d_ino == 0)) { |
| 356 | 356 | continue :start_over; |
| 357 | 357 | } |
| 358 | 358 | |
| ... | ... | @@ -393,17 +393,24 @@ pub const Dir = struct { |
| 393 | 393 | self.index = 0; |
| 394 | 394 | self.end_index = @intCast(usize, rc); |
| 395 | 395 | } |
| 396 | | const freebsd_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]); |
| 397 | | const next_index = self.index + freebsd_entry.reclen(); |
| 396 | const bsd_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]); |
| 397 | const next_index = self.index + bsd_entry.reclen(); |
| 398 | 398 | self.index = next_index; |
| 399 | 399 | |
| 400 | | const name = @ptrCast([*]u8, &freebsd_entry.d_name)[0..freebsd_entry.d_namlen]; |
| 400 | const name = @ptrCast([*]u8, &bsd_entry.d_name)[0..bsd_entry.d_namlen]; |
| 401 | 401 | |
| 402 | | if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) { |
| 402 | const skip_zero_fileno = switch (builtin.os.tag) { |
| 403 | // d_fileno=0 is used to mark invalid entries or deleted files. |
| 404 | .openbsd, .netbsd => true, |
| 405 | else => false, |
| 406 | }; |
| 407 | if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..") or |
| 408 | (skip_zero_fileno and bsd_entry.d_fileno == 0)) |
| 409 | { |
| 403 | 410 | continue :start_over; |
| 404 | 411 | } |
| 405 | 412 | |
| 406 | | const entry_kind = switch (freebsd_entry.d_type) { |
| 413 | const entry_kind = switch (bsd_entry.d_type) { |
| 407 | 414 | os.DT_BLK => Entry.Kind.BlockDevice, |
| 408 | 415 | os.DT_CHR => Entry.Kind.CharacterDevice, |
| 409 | 416 | os.DT_DIR => Entry.Kind.Directory, |