Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: avoid use of cgo by hard-coding maxPathSize #27447

Merged
merged 3 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions rpc/constants_unix.go

This file was deleted.

26 changes: 0 additions & 26 deletions rpc/constants_unix_nocgo.go

This file was deleted.

10 changes: 8 additions & 2 deletions rpc/ipc_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ import (
"github.com/ethereum/go-ethereum/log"
)

const (
// On Linux, sun_path is 108 bytes in size
// see http://man7.org/linux/man-pages/man7/unix.7.html
maxPathSize = int(108)
)

// ipcListen will create a Unix socket on the given endpoint.
func ipcListen(endpoint string) (net.Listener, error) {
// account for null-terminator too
if len(endpoint)+1 > int(max_path_size) {
log.Warn(fmt.Sprintf("The ipc endpoint is longer than %d characters. ", max_path_size-1),
if len(endpoint)+1 > maxPathSize {
fjl marked this conversation as resolved.
Show resolved Hide resolved
log.Warn(fmt.Sprintf("The ipc endpoint is longer than %d characters. ", maxPathSize-1),
"endpoint", endpoint)
}

Expand Down