]> Cypherpunks repositories - gostls13.git/commit
os: ignore O_TRUNC errors on named pipes and terminal devices on Windows
authorqmuntal <quimmuntal@gmail.com>
Thu, 30 Oct 2025 11:36:42 +0000 (12:36 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 5 Nov 2025 07:31:35 +0000 (23:31 -0800)
commit9f3a108ee0d2f08b4994c4201e54e5a53acbc216
tree100b3f7ec147f7b732d0a33ac56c796ef08486fa
parent0e1bd8b5f17e337df0ffb57af03419b96c695fe4
os: ignore O_TRUNC errors on named pipes and terminal devices on Windows

Prior to Go 1.24, os.OpenFile used to support O_TRUNC on named pipes and
terminal devices, even when the truncation was really ignored. This
behavior was consistent with Unix semantics.

CL 618836 changed the implementation of os.OpenFile on Windows and
unintentionally started returning an error when O_TRUNC was used on such
files.

Fixes #76071

Change-Id: Id10d3d8120ae9aa0548ef05423a172ff4e502ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/716420
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/internal/syscall/windows/at_windows.go
src/os/os_windows_test.go
src/os/root_windows_test.go
src/syscall/syscall_windows.go
src/syscall/types_windows.go