Unix Socket Handling (#2280)

* do not set unix socket permissions. Cleanup unix socket.

* removed useless error checking
This commit is contained in:
Ryan J. Yoder 2020-03-16 07:36:15 -07:00 committed by GitHub
parent a71af9c144
commit 67008be35f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
gin.go
View File

@ -320,16 +320,13 @@ func (engine *Engine) RunUnix(file string) (err error) {
debugPrint("Listening and serving HTTP on unix:/%s", file)
defer func() { debugPrintError(err) }()
os.Remove(file)
listener, err := net.Listen("unix", file)
if err != nil {
return
}
defer listener.Close()
err = os.Chmod(file, 0777)
if err != nil {
return
}
defer os.Remove(file)
err = http.Serve(listener, engine)
return
}