| ... | ... | @@ -939,6 +939,7 @@ start_over: |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | pub const Dir = struct { |
| 942 | // See man getdents |
| 942 | 943 | fd: i32, |
| 943 | 944 | allocator: &Allocator, |
| 944 | 945 | buf: []u8, |
| ... | ... | @@ -981,7 +982,7 @@ pub const Dir = struct { |
| 981 | 982 | |
| 982 | 983 | pub fn close(self: &Dir) { |
| 983 | 984 | self.allocator.free(self.buf); |
| 984 | | close(self.fd); |
| 985 | os.close(self.fd); |
| 985 | 986 | } |
| 986 | 987 | |
| 987 | 988 | /// Memory such as file names referenced in this returned entry becomes invalid |
| ... | ... | @@ -1013,7 +1014,7 @@ pub const Dir = struct { |
| 1013 | 1014 | break; |
| 1014 | 1015 | } |
| 1015 | 1016 | } |
| 1016 | | const linux_entry = @ptrCast(&LinuxEntry, &self.buf[self.index]); |
| 1017 | const linux_entry = @ptrCast(& align(1) LinuxEntry, &self.buf[self.index]); |
| 1017 | 1018 | const next_index = self.index + linux_entry.d_reclen; |
| 1018 | 1019 | self.index = next_index; |
| 1019 | 1020 | |