[hostutil_windows] Remove unix workaround

This commit is contained in:
mansikulkarni96 2025-02-17 17:34:21 -05:00
parent 2a32b21372
commit 237aadab89
No known key found for this signature in database
GPG Key ID: 763AA1BBBAC1C99E

View File

@ -29,7 +29,6 @@ import (
"golang.org/x/sys/windows"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/util/filesystem"
"k8s.io/mount-utils"
utilpath "k8s.io/utils/path"
)
@ -103,14 +102,6 @@ func isSystemCannotAccessErr(err error) bool {
func (hu *(HostUtil)) GetFileType(pathname string) (FileType, error) {
filetype, err := getFileType(pathname)
// os.Stat will return a 1920 error (windows.ERROR_CANT_ACCESS_FILE) if we use it on a Unix Socket
// on Windows. In this case, we need to use a different method to check if it's a Unix Socket.
if err == errUnknownFileType || isSystemCannotAccessErr(err) {
if isSocket, errSocket := filesystem.IsUnixDomainSocket(pathname); errSocket == nil && isSocket {
return FileTypeSocket, nil
}
}
return filetype, err
}