1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-12-22 17:52:30 +01:00

Set socket mode after creation.

This commit is contained in:
Koro 2022-07-03 15:27:36 -04:00
parent 89316487e3
commit ed1673beed

View file

@ -174,7 +174,7 @@ func (s *Server) Run() error {
listenStr += fmt.Sprintf(" %s[https]", s.config.ListenHTTPS)
}
if s.config.ListenUnix != "" {
listenStr += fmt.Sprintf(" %s[unix]", s.config.ListenUnix)
listenStr += fmt.Sprintf(" %s[unix/%04o]", s.config.ListenUnix, s.config.ListenUnixMode)
}
if s.config.SMTPServerListen != "" {
listenStr += fmt.Sprintf(" %s[smtp]", s.config.SMTPServerListen)
@ -207,6 +207,11 @@ func (s *Server) Run() error {
errChan <- err
return
}
if err := os.Chmod(s.config.ListenUnix, s.config.ListenUnixMode); err != nil {
s.unixListener.Close()
errChan <- err
return
}
s.mu.Unlock()
httpServer := &http.Server{Handler: mux}
errChan <- httpServer.Serve(s.unixListener)