Skip to content

Commit 9c03b39

Browse files
authored
Merge pull request #8723 from jedisct1/init-stat
Initialize the Stat structure
2 parents 2d11967 + c3675d9 commit 9c03b39

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/std/os.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,7 +3408,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {
34083408
@compileError("fstat is not yet implemented on Windows");
34093409
}
34103410

3411-
var stat: Stat = undefined;
3411+
var stat = mem.zeroes(Stat);
34123412
switch (errno(system.fstat(fd, &stat))) {
34133413
0 => return stat,
34143414
EINVAL => unreachable,
@@ -3459,7 +3459,7 @@ pub fn fstatatWasi(dirfd: fd_t, pathname: []const u8, flags: u32) FStatAtError!S
34593459
/// Same as `fstatat` but `pathname` is null-terminated.
34603460
/// See also `fstatat`.
34613461
pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!Stat {
3462-
var stat: Stat = undefined;
3462+
var stat = mem.zeroes(Stat);
34633463
switch (errno(system.fstatat(dirfd, pathname, &stat, flags))) {
34643464
0 => return stat,
34653465
EINVAL => unreachable,

lib/std/os/test.zig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,6 @@ test "linkat with different directories" {
263263
test "fstatat" {
264264
// enable when `fstat` and `fstatat` are implemented on Windows
265265
if (builtin.os.tag == .windows) return error.SkipZigTest;
266-
if (builtin.os.tag == .freebsd and builtin.mode == .ReleaseFast) {
267-
// https://github.com/ziglang/zig/issues/8538
268-
return error.SkipZigTest;
269-
}
270266

271267
var tmp = tmpDir(.{});
272268
defer tmp.cleanup();

0 commit comments

Comments
 (0)