Add handler for INVALID_HANDLE to prevent infinite loop when stderr is not available.
This commit is contained in:
committed by
Andrew Kelley
parent
b1c7334355
commit
59711becc7
@@ -469,6 +469,7 @@ pub const WriteFileError = error{
|
||||
SystemResources,
|
||||
OperationAborted,
|
||||
BrokenPipe,
|
||||
InvalidFd,
|
||||
Unexpected,
|
||||
};
|
||||
|
||||
@@ -542,6 +543,7 @@ pub fn WriteFile(
|
||||
.NOT_ENOUGH_QUOTA => return error.SystemResources,
|
||||
.IO_PENDING => unreachable,
|
||||
.BROKEN_PIPE => return error.BrokenPipe,
|
||||
.INVALID_HANDLE => return error.NotOpenForWriting,
|
||||
else => |err| return unexpectedError(err),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {
|
||||
error.OutOfMemory => return .OutOfMemory,
|
||||
error.Unexpected => return .Unexpected,
|
||||
error.InputOutput => return .FileSystem,
|
||||
error.InvalidFd => return .FileSystem,
|
||||
};
|
||||
return .None;
|
||||
}
|
||||
@@ -635,6 +636,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
|
||||
error.NotDir => return .NotDir,
|
||||
error.DeviceBusy => return .DeviceBusy,
|
||||
error.FileLocksNotSupported => unreachable,
|
||||
error.InvalidFd => return .FileSystem,
|
||||
};
|
||||
stage1_libc.initFromStage2(libc);
|
||||
return .None;
|
||||
@@ -679,6 +681,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
|
||||
error.AccessDenied => return .AccessDenied,
|
||||
error.Unexpected => return .Unexpected,
|
||||
error.InputOutput => return .FileSystem,
|
||||
error.InvalidFd => return .FileSystem,
|
||||
};
|
||||
return .None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user