Skip to content

Commit

Permalink
Merge pull request containers#8873 from baude/issue8864
Browse files Browse the repository at this point in the history
close journald when reading
  • Loading branch information
openshift-merge-robot authored Jan 5, 2021
2 parents 618c355 + 002d0d6 commit 1b9366d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libpod/events/journal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 1b9366d

Please sign in to comment.