Skip to content

Commit

Permalink
Journald: Close unix socket after use.
Browse files Browse the repository at this point in the history
This is done to ensure unix sockets aren't left dangling after each Enabled() call, which
can lead to eventual process resource exhaustion. Fixes #366.
  • Loading branch information
Jeremy Gill committed Apr 15, 2021
1 parent f65d6c7 commit 68a12a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion journal/journal_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ func Enabled() bool {
return false
}

if _, err := net.Dial("unixgram", journalSocket); err != nil {
conn, err := net.Dial("unixgram", journalSocket)
if err != nil {
return false
}
defer conn.Close()

return true
}
Expand Down

0 comments on commit 68a12a3

Please sign in to comment.