Skip to content

Commit 24a27d9

Browse files
fakecoreSoulPancake
authored andcommitted
fix: handle socket file detection on Windows
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.
1 parent 542c2a6 commit 24a27d9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pkg/kubelet/cm/devicemanager/manager.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,12 @@ func (m *ManagerImpl) CleanupPluginDirectory(dir string) error {
192192
if filePath == m.checkpointFile() {
193193
continue
194194
}
195-
// TODO: Until the bug - https://github.com/golang/go/issues/33357 is fixed, os.stat wouldn't return the
196-
// right mode(socket) on windows. Hence deleting the file, without checking whether
197-
// its a socket, on windows.
198-
stat, err := os.Lstat(filePath)
195+
stat, err := os.Stat(filePath)
199196
if err != nil {
200197
klog.ErrorS(err, "Failed to stat file", "path", filePath)
201198
continue
202199
}
203-
if stat.IsDir() {
200+
if stat.IsDir() || stat.Mode()&os.ModeSocket == 0 {
204201
continue
205202
}
206203
err = os.RemoveAll(filePath)

0 commit comments

Comments
 (0)