aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/images_pull.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-01-04 17:46:24 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-01-04 17:46:24 +0100
commitacbec396fd7f538dc311840a2a018357beb32d3e (patch)
tree67c0dd7807efb87f07551001c6cb2704ef70bc69 /pkg/api/handlers/libpod/images_pull.go
parentf261bfc54961c156c3a4acc2cd1c5379a83f1c0b (diff)
downloadpodman-acbec396fd7f538dc311840a2a018357beb32d3e.tar.gz
podman-acbec396fd7f538dc311840a2a018357beb32d3e.tar.bz2
podman-acbec396fd7f538dc311840a2a018357beb32d3e.zip
libpod API: pull: fix channel race
Fix a race condition in the pull endpoint caused by buffered channels. Using buffered channels can lead to the context's cancel function to be executed prior to the items being read from the channel. Fixes: #8870 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/images_pull.go')
-rw-r--r--pkg/api/handlers/libpod/images_pull.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go
index 5e2727e95..bacba006d 100644
--- a/pkg/api/handlers/libpod/images_pull.go
+++ b/pkg/api/handlers/libpod/images_pull.go
@@ -115,10 +115,10 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
}
}
- writer := channel.NewWriter(make(chan []byte, 1))
+ writer := channel.NewWriter(make(chan []byte))
defer writer.Close()
- stderr := channel.NewWriter(make(chan []byte, 1))
+ stderr := channel.NewWriter(make(chan []byte))
defer stderr.Close()
images := make([]string, 0, len(imagesToPull))