From 41fc891173382c126ed1f902f46f2cac46fff924 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 1 Apr 2020 11:11:23 +0200 Subject: attach: skip shutdown on errors skip doing a socket shutdown on an error, since we are not sure the socket was already closed and we end up using the wrong fd. Signed-off-by: Giuseppe Scrivano --- libpod/oci_attach_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libpod/oci_attach_linux.go') diff --git a/libpod/oci_attach_linux.go b/libpod/oci_attach_linux.go index 433993edb..fb0a54bff 100644 --- a/libpod/oci_attach_linux.go +++ b/libpod/oci_attach_linux.go @@ -200,8 +200,10 @@ func setupStdioChannels(streams *AttachStreams, conn *net.UnixConn, detachKeys [ var err error if streams.AttachInput { _, err = utils.CopyDetachable(conn, streams.InputStream, detachKeys) - if connErr := conn.CloseWrite(); connErr != nil { - logrus.Errorf("unable to close conn: %q", connErr) + if err == nil { + if connErr := conn.CloseWrite(); connErr != nil { + logrus.Errorf("unable to close conn: %q", connErr) + } } } stdinDone <- err -- cgit v1.2.3-54-g00ecf