]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] syscall: don't truncate newly created files on Windows
authorqmuntal <quimmuntal@gmail.com>
Tue, 18 Feb 2025 10:55:07 +0000 (11:55 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 19 Feb 2025 18:46:24 +0000 (10:46 -0800)
commit30f4d9e117ba66f77bf9dc507da4ad35c747d0cb
tree05664e0345b96f8ae297ae694849878d5fcbca5c
parentbb0e5c2045babea251436b32848dc904a59b3657
[release-branch.go1.24] syscall: don't truncate newly created files on Windows

There is no need for syscall.OpenFile to truncate newly created files.
Some special Windows files, like the NUL device, can't be
truncated, so we should avoid truncating unless it is really necessary.

For #71752
Fixes #71836

Change-Id: I8238048594f706f6a5281053d55cfe3dc898828d
Reviewed-on: https://go-review.googlesource.com/c/go/+/650276
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit 4267fd389e941cf197cc3890cc42e474866c0d30)
Reviewed-on: https://go-review.googlesource.com/c/go/+/650597
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
src/os/os_test.go
src/syscall/syscall_windows.go
src/syscall/zsyscall_windows.go