pkg/bindings/containers: don't check for short read

io.ReadFull() already returns ErrUnexpectedEOF if there was a short read
so this check is redundant and can be dropped.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-07-09 17:56:26 +02:00
parent 9f264850d6
commit f42453457c

View File

@@ -259,14 +259,10 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
// DemuxHeader reads header for stream from server multiplexed stdin/stdout/stderr/2nd error channel
func DemuxHeader(r io.Reader, buffer []byte) (fd, sz int, err error) {
n, err := io.ReadFull(r, buffer[0:8])
_, err = io.ReadFull(r, buffer[0:8])
if err != nil {
return
}
if n < 8 {
err = io.ErrUnexpectedEOF
return
}
fd = int(buffer[0])
if fd < 0 || fd > 3 {
@@ -284,14 +280,10 @@ func DemuxFrame(r io.Reader, buffer []byte, length int) (frame []byte, err error
buffer = append(buffer, make([]byte, length-len(buffer)+1)...)
}
n, err := io.ReadFull(r, buffer[0:length])
_, err = io.ReadFull(r, buffer[0:length])
if err != nil {
return nil, err
}
if n < length {
err = io.ErrUnexpectedEOF
return
}
return buffer[0:length], nil
}