authorgravatar for egoist@egoistic.devxEgoist <egoist@egoistic.dev> 2023-04-25 11:21:52-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-25 10:37:49-07:00
logf780a6b024f25838560cce6e0bd93c808e09457b
tree88534584c410460f73b4a8b9f5abd8a9db063c4c
parentd8bdfd8192fb43ca8f6abd223396a4073e369499

std: further windows resource fix

addition to #15450 createFileW does not account for failure on `LockFile`. This can result in a file handle not being closed on failure which can be seen on test such as `fs.test.'open file with exclusive nonblocking lock twice'`.

1 files changed, 1 insertions(+), 0 deletions(-)

lib/std/fs.zig+1
...@@ -1397,6 +1397,7 @@ pub const Dir = struct {...@@ -1397,6 +1397,7 @@ pub const Dir = struct {
1397 .capable_io_mode = std.io.default_mode,1397 .capable_io_mode = std.io.default_mode,
1398 .intended_io_mode = flags.intended_io_mode,1398 .intended_io_mode = flags.intended_io_mode,
1399 };1399 };
1400 errdefer file.close();
1400 var io: w.IO_STATUS_BLOCK = undefined;1401 var io: w.IO_STATUS_BLOCK = undefined;
1401 const range_off: w.LARGE_INTEGER = 0;1402 const range_off: w.LARGE_INTEGER = 0;
1402 const range_len: w.LARGE_INTEGER = 1;1403 const range_len: w.LARGE_INTEGER = 1;