mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
windows: fix test causing checkptr failure
TestNtCreateFileAndNtSetInformationFile is failing checkptr. Fix by using replacing [:] with [:n:n]. Fixes golang/go#49217 Change-Id: I08e7ed41b33452c096cf40cdbf9d73989b769bdb Reviewed-on: https://go-review.googlesource.com/c/sys/+/359496 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
@@ -922,7 +922,7 @@ func TestNtCreateFileAndNtSetInformationFile(t *testing.T) {
|
||||
typedBufferPtr := (*fileRenameInformation)(unsafe.Pointer(&buffer[0]))
|
||||
typedBufferPtr.ReplaceIfExists = windows.FILE_RENAME_REPLACE_IF_EXISTS | windows.FILE_RENAME_POSIX_SEMANTICS
|
||||
typedBufferPtr.FileNameLength = uint32(fileNameLen)
|
||||
copy((*[1 << 29]uint16)(unsafe.Pointer(&typedBufferPtr.FileName[0]))[:], newNameUTF16)
|
||||
copy((*[windows.MAX_LONG_PATH]uint16)(unsafe.Pointer(&typedBufferPtr.FileName[0]))[:fileNameLen/2:fileNameLen/2], newNameUTF16)
|
||||
err = windows.NtSetInformationFile(fileHandle, &iosb, &buffer[0], uint32(bufferSize), windows.FileRenameInformation)
|
||||
if err != nil {
|
||||
t.Fatalf("NtSetInformationFile(%v) failed: %v", newPath, err)
|
||||
|
||||
Reference in New Issue
Block a user