Skip to content

Commit 68a12a3

Browse files
author
Jeremy Gill
committed
Journald: Close unix socket after use.
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.
1 parent f65d6c7 commit 68a12a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

journal/journal_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ func Enabled() bool {
6565
return false
6666
}
6767

68-
if _, err := net.Dial("unixgram", journalSocket); err != nil {
68+
conn, err := net.Dial("unixgram", journalSocket)
69+
if err != nil {
6970
return false
7071
}
72+
defer conn.Close()
7173

7274
return true
7375
}

0 commit comments

Comments
 (0)