diff options
Diffstat (limited to 'internal/cmd')
-rw-r--r-- | internal/cmd/web.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/cmd/web.go b/internal/cmd/web.go index 30501bde..e78eefcc 100644 --- a/internal/cmd/web.go +++ b/internal/cmd/web.go @@ -35,6 +35,7 @@ import ( "gogs.io/gogs/internal/context" "gogs.io/gogs/internal/db" "gogs.io/gogs/internal/form" + "gogs.io/gogs/internal/osutil" "gogs.io/gogs/internal/route" "gogs.io/gogs/internal/route/admin" apiv1 "gogs.io/gogs/internal/route/api/v1" @@ -690,10 +691,11 @@ func runWeb(c *cli.Context) error { var listenAddr string if conf.Server.Protocol == "unix" { listenAddr = conf.Server.HTTPAddr + log.Info("Listen on %v://%s", conf.Server.Protocol, listenAddr) } else { listenAddr = fmt.Sprintf("%s:%s", conf.Server.HTTPAddr, conf.Server.HTTPPort) + log.Info("Listen on %v://%s%s", conf.Server.Protocol, listenAddr, conf.Server.Subpath) } - log.Info("Listen on %v://%s%s", conf.Server.Protocol, listenAddr, conf.Server.Subpath) switch conf.Server.Protocol { case "http": @@ -732,9 +734,11 @@ func runWeb(c *cli.Context) error { err = fcgi.Serve(nil, m) case "unix": - err = os.Remove(listenAddr) - if err != nil { - log.Fatal("Failed to remove existing Unix domain socket: %v", err) + if osutil.IsExist(listenAddr) { + err = os.Remove(listenAddr) + if err != nil { + log.Fatal("Failed to remove existing Unix domain socket: %v", err) + } } var listener *net.UnixListener |