From 043fd8b536fc98b0edcd2fc5fd8024c599e99a5d Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Tue, 30 May 2023 17:15:57 +0800 Subject: [PATCH] fix: on windows use FindClose close handler (#17306) --- cmd/os_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/os_windows.go b/cmd/os_windows.go index d06a65151..f017768bd 100644 --- a/cmd/os_windows.go +++ b/cmd/os_windows.go @@ -53,7 +53,7 @@ func readDirFn(dirPath string, filter func(name string, typ os.FileMode) error) } return err } - defer syscall.CloseHandle(handle) + defer syscall.FindClose(handle) for ; ; err = syscall.FindNextFile(handle, data) { if err != nil { @@ -128,7 +128,7 @@ func readDirWithOpts(dirPath string, opts readDirOpts) (entries []string, err er return nil, syscallErrToFileErr(dirPath, err) } - defer syscall.CloseHandle(handle) + defer syscall.FindClose(handle) count := opts.count for ; count != 0; err = syscall.FindNextFile(handle, data) {