From b990b615d88d208d86b45d31271ce974d2290ba0 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Tue, 7 Jul 2020 21:08:36 +0100 Subject: clean up old sockets and chmod new ones --- cmd/dispatch/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/dispatch/main.go b/cmd/dispatch/main.go index 032797d..a940584 100644 --- a/cmd/dispatch/main.go +++ b/cmd/dispatch/main.go @@ -9,6 +9,7 @@ import ( "context" "net" "net/http" + "os" "github.com/gorilla/mux" "go.eth.moe/dispatch/config" @@ -45,6 +46,10 @@ func main() { log.WithError(err).Fatal("could not parse config") } + if listen.Network() == "unix" { + _ = os.Remove(listen.String()) + } + log.AddField("http.listen", listen) conn, err := net.Listen(listen.Network(), listen.String()) if err != nil { @@ -52,6 +57,10 @@ func main() { } defer conn.Close() + if listen.Network() == "unix" { + _ = os.Chmod(listen.String(), 0660) + } + m := mux.NewRouter() m.NotFoundHandler = httputil.NotFoundHandler -- cgit v1.2.3