Fix file descriptor leak in fs.openFileZ.

This commit is contained in:
Alex Cameron 2020-11-02 22:51:30 +11:00 committed by Andrew Kelley
parent 50ba018223
commit ecdd636605

View File

@ -752,6 +752,7 @@ pub const Dir = struct {
try std.event.Loop.instance.?.openatZ(self.fd, sub_path, os_flags, 0)
else
try os.openatZ(self.fd, sub_path, os_flags, 0);
errdefer os.close(fd);
if (!has_flock_open_flags and flags.lock != .None) {
// TODO: integrate async I/O