From 5d745e2ead1f122f90ba00be9d72f5121c33133a Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 17 Oct 2026 22:42:08 +0200 Subject: [PATCH] windows: use os.OpenFile with O_FILE_FLAG_* instead of low-level API --- internal/fs/priv_windows_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/fs/priv_windows_test.go b/internal/fs/priv_windows_test.go index 0db7144e8..504cc678f 100644 --- a/internal/fs/priv_windows_test.go +++ b/internal/fs/priv_windows_test.go @@ -25,11 +25,9 @@ func TestRestorePrivilegeBypassACL(t *testing.T) { testPath := testGetRestrictedFilePath(t) // Writable OpenFile needs explicit FILE_FLAG_BACKUP_SEMANTICS. - // Go with issue #73676 merged would allow: os.OpenFile(testPath, os.O_WRONLY|windows.O_FILE_FLAG_BACKUP_SEMANTICS, 0) - utf16Path := windows.StringToUTF16Ptr(testPath) - handle, err := windows.CreateFile(utf16Path, windows.GENERIC_WRITE, 0, nil, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL|windows.FILE_FLAG_BACKUP_SEMANTICS, 0) + testfile, err := os.OpenFile(testPath, os.O_WRONLY|windows.O_FILE_FLAG_BACKUP_SEMANTICS, 0) test.OK(t, errors.Wrapf(err, "failed to open file for writing: %s", testPath)) - test.OK(t, windows.Close(handle)) + test.OK(t, testfile.Close()) } func testGetRestrictedFilePath(t *testing.T) string {