summaryrefslogtreecommitdiff
path: root/libpod/events/journal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-21 10:55:40 -0400
committerGitHub <noreply@github.com>2020-07-21 10:55:40 -0400
commitf8e2a3500e3daadf21137d1647cabf9ef20b2114 (patch)
treea4825917b192332599841cdcc41096af39a4b474 /libpod/events/journal_linux.go
parent644b5bc8a35760654824c46cad8618e0d6e634bc (diff)
parentdea93c27d2809cd5a04563d27cf00a8e682884c8 (diff)
downloadpodman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.tar.gz
podman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.tar.bz2
podman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.zip
Merge pull request #6902 from vrothberg/events-endpoint
events endpoint: fix panic and race condition
Diffstat (limited to 'libpod/events/journal_linux.go')
-rw-r--r--libpod/events/journal_linux.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index d341ca7b5..7c2a3e0f2 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -90,6 +90,13 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
return err
}
for {
+ select {
+ case <-ctx.Done():
+ // the consumer has cancelled
+ return nil
+ default:
+ // fallthrough
+ }
if _, err := j.Next(); err != nil {
return err
}