authorgravatar for strangebug@ineedtojet.comStrangeBug <strangebug@ineedtojet.com> 2020-05-22 20:24:16+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-19 20:49:25-07:00
log59711becc74911ba251001de81bbac2a53e81b9f
tree982cd513dff0a2bf36633ca9c3bbd88d27184992
parentb1c7334355b345a6c244f617c2d4fae9e9f82c5a

Add handler for INVALID_HANDLE to prevent infinite loop when stderr is not available.


2 files changed, 5 insertions(+), 0 deletions(-)

lib/std/os/windows.zig+2
......@@ -469,6 +469,7 @@ pub const WriteFileError = error{
469469 SystemResources,
470470 OperationAborted,
471471 BrokenPipe,
472 InvalidFd,
472473 Unexpected,
473474};
474475
......@@ -542,6 +543,7 @@ pub fn WriteFile(
542543 .NOT_ENOUGH_QUOTA => return error.SystemResources,
543544 .IO_PENDING => unreachable,
544545 .BROKEN_PIPE => return error.BrokenPipe,
546 .INVALID_HANDLE => return error.NotOpenForWriting,
545547 else => |err| return unexpectedError(err),
546548 }
547549 }
src-self-hosted/stage2.zig+3
......@@ -164,6 +164,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {
164164 error.OutOfMemory => return .OutOfMemory,
165165 error.Unexpected => return .Unexpected,
166166 error.InputOutput => return .FileSystem,
167 error.InvalidFd => return .FileSystem,
167168 };
168169 return .None;
169170}
......@@ -635,6 +636,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
635636 error.NotDir => return .NotDir,
636637 error.DeviceBusy => return .DeviceBusy,
637638 error.FileLocksNotSupported => unreachable,
639 error.InvalidFd => return .FileSystem,
638640 };
639641 stage1_libc.initFromStage2(libc);
640642 return .None;
......@@ -679,6 +681,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
679681 error.AccessDenied => return .AccessDenied,
680682 error.Unexpected => return .Unexpected,
681683 error.InputOutput => return .FileSystem,
684 error.InvalidFd => return .FileSystem,
682685 };
683686 return .None;
684687}