From 6013aaa370e1f754284722e12ef315aa9253939a Mon Sep 17 00:00:00 2001 From: Anthony ARNAUD Date: Tue, 29 Dec 2020 13:53:56 -0500 Subject: [PATCH] use Lstat instead of Stat for unix socket on windows --- pkg/kubelet/cm/devicemanager/manager.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/cm/devicemanager/manager.go b/pkg/kubelet/cm/devicemanager/manager.go index e103b875bda..2dffa038a97 100644 --- a/pkg/kubelet/cm/devicemanager/manager.go +++ b/pkg/kubelet/cm/devicemanager/manager.go @@ -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