aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-09-14 20:45:11 +0800
committerFelix Lange <fjl@twurst.com>2015-09-14 20:45:11 +0800
commit47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5 (patch)
treef91ece07bac30fd417d97a7f16c331cc1c66ff8b /rpc
parenta9c809b441146dcd2c3f4d174f00148a510aeb75 (diff)
parent3e6964b841bb22c4eab4cdaa22655beeae577419 (diff)
downloaddexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar.gz
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar.bz2
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar.lz
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar.xz
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.tar.zst
dexon-47b9c640f5fa5f01c1d2849c00f5a42f190cc2c5.zip
Merge pull request #1797 from karalabe/ensure-ipcpath-exists
rpc/comms: fix #1795, ensure IPC path exists before binding
Diffstat (limited to 'rpc')
-rw-r--r--rpc/comms/ipc_unix.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go
index 9d90da071..d68363a45 100644
--- a/rpc/comms/ipc_unix.go
+++ b/rpc/comms/ipc_unix.go
@@ -21,6 +21,7 @@ package comms
import (
"net"
"os"
+ "path/filepath"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
@@ -69,7 +70,11 @@ func (self *ipcClient) reconnect() error {
}
func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error {
- os.Remove(cfg.Endpoint) // in case it still exists from a previous run
+ // Ensure the IPC path exists and remove any previous leftover
+ if err := os.MkdirAll(filepath.Dir(cfg.Endpoint), 0751); err != nil {
+ return err
+ }
+ os.Remove(cfg.Endpoint)
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"})
if err != nil {