Skip to content

Commit e63f992

Browse files
rpc: fix ipc max path size (ethereum#29385)
1 parent 31e63fc commit e63f992

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rpc/ipc_unix.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ import (
2525
"net"
2626
"os"
2727
"path/filepath"
28+
"syscall"
2829

2930
"github.com/ethereum/go-ethereum/log"
3031
)
3132

3233
const (
33-
// On Linux, sun_path is 108 bytes in size
34-
// see http://man7.org/linux/man-pages/man7/unix.7.html
35-
maxPathSize = int(108)
34+
// The limit of unix domain socket path diverse between OS, on Darwin it's 104 bytes
35+
// but on Linux it's 108 byte, so we should depend on syscall.RawSockaddrUnix's
36+
// definition dynamically
37+
maxPathSize = len(syscall.RawSockaddrUnix{}.Path)
3638
)
3739

3840
// ipcListen will create a Unix socket on the given endpoint.

0 commit comments

Comments
 (0)