mirror of
https://github.com/hyprspace/hyprspace.git
synced 2026-09-12 19:51:07 +05:00
rpc: try to remove socket if already exists (#89)
This commit is contained in:
parent
e994260bdb
commit
df929520a9
@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/rpc"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
@ -178,6 +179,11 @@ func RpcServer(ctx context.Context, wg *sync.WaitGroup, ma multiaddr.Multiaddr,
|
||||
var l net.Listener
|
||||
oldUmask := syscall.Umask(0o007)
|
||||
|
||||
err = os.Remove(addr)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Fatal("[!] Could not remove old RPC socket: ", err)
|
||||
}
|
||||
|
||||
var lc net.ListenConfig
|
||||
l, err = lc.Listen(ctx, "unix", addr)
|
||||
syscall.Umask(oldUmask)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user