From ff118ad0f8d9cf99903d3391ca3a295671022cee Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 27 Jan 2016 11:08:46 -0500 Subject: [PATCH] Close the tempfile when journaling large messages When we fail to log a message to journald due to ENOBUFS or EMSGSIZE, we attempt to pass the message to journald by passing it a descriptor attached to some shared memory. We need to close the descriptor, too. --- journal/journal.go | 1 + 1 file changed, 1 insertion(+) diff --git a/journal/journal.go b/journal/journal.go index 6c3f5b94..7f434990 100644 --- a/journal/journal.go +++ b/journal/journal.go @@ -90,6 +90,7 @@ func Send(message string, priority Priority, vars map[string]string) error { if err != nil { return journalError(err.Error()) } + defer file.Close() _, err = io.Copy(file, data) if err != nil { return journalError(err.Error())