mirror of
https://github.com/rclone/rclone.git
synced 2024-12-05 07:20:35 +08:00
23 lines
414 B
Go
23 lines
414 B
Go
|
// +build !windows,!plan9,!js
|
||
|
|
||
|
package local
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"syscall"
|
||
|
)
|
||
|
|
||
|
// isCircularSymlinkError checks if the current error code is because of a circular symlink
|
||
|
func isCircularSymlinkError(err error) bool {
|
||
|
if err != nil {
|
||
|
if newerr, ok := err.(*os.PathError); ok {
|
||
|
if errcode, ok := newerr.Err.(syscall.Errno); ok {
|
||
|
if errcode == syscall.ELOOP {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|