Return unwrapped ErrNotExist when EvalSymlink returns PathError
By default filepath.EvalSymlink returns PathError. When a file is not found, we should unwrap it and return ErrNotExist as this is what this function expects. Similar to the comment at: https://github.com/kubernetes/kubernetes/pull/109217#discussion_r896272206
This commit is contained in:
		@@ -732,6 +732,9 @@ func (mounter *Mounter) IsMountPoint(file string) (bool, error) {
 | 
			
		||||
	// Resolve any symlinks in file, kernel would do the same and use the resolved path in /proc/mounts.
 | 
			
		||||
	resolvedFile, err := filepath.EvalSymlinks(file)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if errors.Is(isMntErr, fs.ErrNotExist) {
 | 
			
		||||
			return false, fs.ErrNotExist
 | 
			
		||||
		}
 | 
			
		||||
		return false, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user