From 918ce5a3fcf9f89e63685d1ffa7cf50e1889a41e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 3 Mar 2019 19:32:36 +0000 Subject: [PATCH] Add a timeout on the UNIX admin socket check --- src/yggdrasil/admin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 211f3c2d..62803395 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -403,7 +403,7 @@ func (a *admin) listen() { case "unix": if _, err := os.Stat(a.listenaddr[7:]); err == nil { a.core.log.Debugln("Admin socket", a.listenaddr[7:], "already exists, trying to clean up") - if _, err := net.Dial("unix", a.listenaddr[7:]); err == nil { + if _, err := net.DialTimeout("unix", a.listenaddr[7:], time.Second*2); err == nil || err.(net.Error).Timeout() { a.core.log.Errorln("Admin socket", a.listenaddr[7:], "already exists and is in use by another process") os.Exit(1) } else {