Skip to content

Commit d9ac84b

Browse files
committed
Plan 9 support: Remove dependency on syscall.ELOOP
Provide package level ErrLoop instead. Signed-off-by: Ronald G Minnich <[email protected]>
1 parent f277210 commit d9ac84b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

join.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import (
1515

1616
const maxSymlinkLimit = 255
1717

18+
// ErrLoop is returned when too many symbolic links are encountered.
19+
var ErrLoop = errors.New("Too many symbolic links were encountered in translating the pathname")
20+
1821
// IsNotExist tells you if err is an error that implies that either the path
1922
// accessed does not exist (or path components don't exist). This is
2023
// effectively a more broad version of [os.IsNotExist].
@@ -139,7 +142,7 @@ func SecureJoinVFS(root, unsafePath string, vfs VFS) (string, error) {
139142
// to the yet-unparsed path.
140143
linksWalked++
141144
if linksWalked > maxSymlinkLimit {
142-
return "", &os.PathError{Op: "SecureJoin", Path: root + string(filepath.Separator) + unsafePath, Err: syscall.ELOOP}
145+
return "", &os.PathError{Op: "SecureJoin", Path: root + string(filepath.Separator) + unsafePath, Err: ErrLoop}
143146
}
144147

145148
dest, err := vfs.Readlink(fullPath)

0 commit comments

Comments
 (0)