mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: work around FreeBSD execve kernel bug
FreeBSD's execve implementation has an integer underflow in a bounds test which causes it to erroneously think the argument list is too long when argv[0] is longer than interpreter + path. R=rsc, bradfitz, rsc1 CC=golang-dev https://golang.org/cl/4259056
This commit is contained in:
parent
9e25eccf48
commit
eeb8d00c86
1 changed files with 4 additions and 0 deletions
|
|
@ -238,6 +238,10 @@ func forkExec(argv0 string, argv []string, envv []string, traceme bool, dir stri
|
||||||
dirp = StringBytePtr(dir)
|
dirp = StringBytePtr(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if OS == "freebsd" && len(argv[0]) > len(argv0) {
|
||||||
|
argvp[0] = argv0p
|
||||||
|
}
|
||||||
|
|
||||||
// Acquire the fork lock so that no other threads
|
// Acquire the fork lock so that no other threads
|
||||||
// create new fds that are not yet close-on-exec
|
// create new fds that are not yet close-on-exec
|
||||||
// before we fork.
|
// before we fork.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue