diff options
author | baude <bbaude@redhat.com> | 2021-01-04 09:32:18 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-01-04 13:27:38 -0600 |
commit | 002d0d6ee6a4297bbcf2cf1d113536d28f7f75d1 (patch) | |
tree | a9f2f8f42fd71728f842cceab8eb67a3a76c8c54 /libpod/events/journal_linux.go | |
parent | f261bfc54961c156c3a4acc2cd1c5379a83f1c0b (diff) | |
download | podman-002d0d6ee6a4297bbcf2cf1d113536d28f7f75d1.tar.gz podman-002d0d6ee6a4297bbcf2cf1d113536d28f7f75d1.tar.bz2 podman-002d0d6ee6a4297bbcf2cf1d113536d28f7f75d1.zip |
close journald when reading
when reading from journald, we need to close the journal handler for
events and logging.
Fixes: #8864
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/events/journal_linux.go')
-rw-r--r-- | libpod/events/journal_linux.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go index 71c638017..8b7e448b1 100644 --- a/libpod/events/journal_linux.go +++ b/libpod/events/journal_linux.go @@ -84,7 +84,11 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error { if err != nil { return err } - + defer func() { + if err := j.Close(); err != nil { + logrus.Errorf("Unable to close journal :%v", err) + } + }() // match only podman journal entries podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"} if err := j.AddMatch(podmanJournal.String()); err != nil { @@ -112,7 +116,6 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error { if err != nil { return errors.Wrap(err, "failed to get journal cursor") } - for { select { case <-ctx.Done(): |