Merge pull request #97576 from aarnaud/fix/stat-windows-socket

use Lstat instead of Stat for unix socket on windows
This commit is contained in:
Kubernetes Prow Robot 2020-12-30 16:45:49 -08:00 committed by GitHub
commit 68b908d785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,7 +211,10 @@ func (m *ManagerImpl) removeContents(dir string) error {
if filePath == m.checkpointFile() {
continue
}
stat, err := os.Stat(filePath)
// TODO: Until the bug - https://github.com/golang/go/issues/33357 is fixed, os.stat wouldn't return the
// right mode(socket) on windows. Hence deleting the file, without checking whether
// its a socket, on windows.
stat, err := os.Lstat(filePath)
if err != nil {
klog.Errorf("Failed to stat file %s: %v", filePath, err)
continue