darwin does not have PATH_MAX
Define our own, with the value from Linux.
This commit is contained in:
parent
5ad26495fc
commit
bde7ba57b0
@ -29,7 +29,7 @@ func exitOnUsr1() {
|
|||||||
func forkChild() int {
|
func forkChild() int {
|
||||||
name := os.Args[0]
|
name := os.Args[0]
|
||||||
// Use the full path to our executable if we can get if from /proc.
|
// Use the full path to our executable if we can get if from /proc.
|
||||||
buf := make([]byte, syscall.PathMax)
|
buf := make([]byte, syscallcompat.PATH_MAX)
|
||||||
n, err := syscall.Readlink("/proc/self/exe", buf)
|
n, err := syscall.Readlink("/proc/self/exe", buf)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
name = string(buf[:n])
|
name = string(buf[:n])
|
||||||
|
@ -333,8 +333,7 @@ func (rfs *ReverseFS) Readlink(relPath string, context *fuse.Context) (string, f
|
|||||||
cTarget := rfs.nameTransform.B64.EncodeToString(cBinTarget)
|
cTarget := rfs.nameTransform.B64.EncodeToString(cBinTarget)
|
||||||
// The kernel will reject a symlink target above 4096 chars and return
|
// The kernel will reject a symlink target above 4096 chars and return
|
||||||
// and I/O error to the user. Better emit the proper error ourselves.
|
// and I/O error to the user. Better emit the proper error ourselves.
|
||||||
const PATH_MAX = 4096 // not defined on Darwin
|
if len(cTarget) > syscallcompat.PATH_MAX {
|
||||||
if len(cTarget) > PATH_MAX {
|
|
||||||
return "", fuse.Status(syscall.ENAMETOOLONG)
|
return "", fuse.Status(syscall.ENAMETOOLONG)
|
||||||
}
|
}
|
||||||
return cTarget, fuse.OK
|
return cTarget, fuse.OK
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const PATH_MAX = 4096 // not defined on Darwin
|
||||||
|
|
||||||
// Readlinkat exists both in Linux and in MacOS 10.10+. We may add an
|
// Readlinkat exists both in Linux and in MacOS 10.10+. We may add an
|
||||||
// emulated version for users on older MacOS versions if there is
|
// emulated version for users on older MacOS versions if there is
|
||||||
// demand.
|
// demand.
|
||||||
|
Loading…
Reference in New Issue
Block a user