diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-06 20:08:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 20:08:02 +0200 |
commit | 03c17e94078236531b02ab437721853a09df119f (patch) | |
tree | 27cd9b717db7c10b72da3b7bd4bd83272f3a8cb0 /pkg | |
parent | 36504be96705423349ad437efab0cfc745085881 (diff) | |
parent | fbce7584d786ed99354a4b33a9c127abd673c3bb (diff) | |
download | podman-03c17e94078236531b02ab437721853a09df119f.tar.gz podman-03c17e94078236531b02ab437721853a09df119f.tar.bz2 podman-03c17e94078236531b02ab437721853a09df119f.zip |
Merge pull request #11864 from Luap99/close
libpod: fix race when closing STDIN
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/bindings/containers/attach.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go index abf58aaf9..c5f54c1af 100644 --- a/pkg/bindings/containers/attach.go +++ b/pkg/bindings/containers/attach.go @@ -157,24 +157,24 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri } stdoutChan := make(chan error) - stdinChan := make(chan error) + stdinChan := make(chan error, 1) //stdin channel should not block if isSet.stdin { go func() { logrus.Debugf("Copying STDIN to socket") _, err := utils.CopyDetachable(socket, stdin, detachKeysInBytes) - if err != nil && err != define.ErrDetach { logrus.Errorf("Failed to write input to service: %v", err) } - stdinChan <- err - - if closeWrite, ok := socket.(CloseWriter); ok { - if err := closeWrite.CloseWrite(); err != nil { - logrus.Warnf("Failed to close STDIN for writing: %v", err) + if err == nil { + if closeWrite, ok := socket.(CloseWriter); ok { + if err := closeWrite.CloseWrite(); err != nil { + logrus.Warnf("Failed to close STDIN for writing: %v", err) + } } } + stdinChan <- err }() } |