good morning!!!!

Skip to content
Snippets Groups Projects
Commit b025053a authored by Martin Alex Philip Dawson's avatar Martin Alex Philip Dawson Committed by Guillaume Ballet
Browse files

rpc: Warn the user when the path name is too long for the Unix ipc endpoint (#18330)

parent 9bfd0b60
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,31 @@ package rpc
import (
"context"
"fmt"
"net"
"os"
"path/filepath"
"github.com/ethereum/go-ethereum/log"
)
/*
#include <sys/un.h>
int max_socket_path_size() {
struct sockaddr_un s;
return sizeof(s.sun_path);
}
*/
import "C"
// ipcListen will create a Unix socket on the given endpoint.
func ipcListen(endpoint string) (net.Listener, error) {
if len(endpoint) > int(C.max_socket_path_size()) {
log.Warn(fmt.Sprintf("The ipc endpoint is longer than %d characters. ", C.max_socket_path_size()),
"endpoint", endpoint)
}
// Ensure the IPC path exists and remove any previous leftover
if err := os.MkdirAll(filepath.Dir(endpoint), 0751); err != nil {
return nil, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment