mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 22:33:34 +00:00
fix: handle socket file detection on Windows
Cherry-picked 4060ee60c1
Update socket file detection logic to use os.Stat as per upstream
Go fix for golang/go#33357. This resolves
the issue where socket files could not be properly identified on
Windows systems.
This commit is contained in:
parent
dfc8b271cf
commit
b9f6013c12
@ -202,15 +202,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)
|
||||
|
Loading…
Reference in New Issue
Block a user