]> Cypherpunks repositories - gostls13.git/commit
syscall: don't truncate newly created files on Windows
authorqmuntal <quimmuntal@gmail.com>
Tue, 18 Feb 2025 10:55:07 +0000 (11:55 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 19 Feb 2025 12:43:02 +0000 (04:43 -0800)
commit4267fd389e941cf197cc3890cc42e474866c0d30
tree3f067656ef2f6bba2877fb2ed5d65c481c683b3e
parenta08984bc8f2acacebeeadf7445ecfb67b7e7d7b1
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.

Fixes #71752.

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>
src/os/os_test.go
src/syscall/syscall_windows.go
src/syscall/zsyscall_windows.go