github.com/artpar/rclone@v1.67.3/backend/local/symlink.go (about)

     1  //go:build !windows && !plan9 && !js
     2  
     3  package local
     4  
     5  import (
     6  	"os"
     7  	"syscall"
     8  )
     9  
    10  // isCircularSymlinkError checks if the current error code is because of a circular symlink
    11  func isCircularSymlinkError(err error) bool {
    12  	if err != nil {
    13  		if newerr, ok := err.(*os.PathError); ok {
    14  			if errcode, ok := newerr.Err.(syscall.Errno); ok {
    15  				if errcode == syscall.ELOOP {
    16  					return true
    17  				}
    18  			}
    19  		}
    20  	}
    21  	return false
    22  }