diff --git a/pkg/kubelet/cm/devicemanager/manager.go b/pkg/kubelet/cm/devicemanager/manager.go index f1d04e9717934..61f14fd5ab894 100644 --- a/pkg/kubelet/cm/devicemanager/manager.go +++ b/pkg/kubelet/cm/devicemanager/manager.go @@ -192,15 +192,12 @@ func (m *ManagerImpl) CleanupPluginDirectory(dir string) error { if filePath == m.checkpointFile() { continue } - // 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) + stat, err := os.Stat(filePath) if err != nil { klog.ErrorS(err, "Failed to stat file", "path", filePath) continue } - if stat.IsDir() { + if stat.IsDir() || stat.Mode()&os.ModeSocket == 0 { continue } err = os.RemoveAll(filePath)