From 0fb6f5f21b20759a0cdbc25df0c152600fd93b4d Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Mon, 21 Jan 2013 11:22:08 -0500 Subject: [PATCH] crypto/cipher: don't persist errors in StreamWriter. I messed this up from the beginning. The receiver isn't a pointer so setting Err is useless. In order to maintain the API, just remove the superfluous code. Fixes #4657. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7161043 --- src/pkg/crypto/cipher/io.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pkg/crypto/cipher/io.go b/src/pkg/crypto/cipher/io.go index 76048fbf339..807e8daeaf4 100644 --- a/src/pkg/crypto/cipher/io.go +++ b/src/pkg/crypto/cipher/io.go @@ -28,13 +28,10 @@ func (r StreamReader) Read(dst []byte) (n int, err error) { type StreamWriter struct { S Stream W io.Writer - Err error + Err error // unused } func (w StreamWriter) Write(src []byte) (n int, err error) { - if w.Err != nil { - return 0, w.Err - } c := make([]byte, len(src)) w.S.XORKeyStream(c, src) n, err = w.W.Write(c) @@ -42,7 +39,6 @@ func (w StreamWriter) Write(src []byte) (n int, err error) { if err == nil { // should never happen err = io.ErrShortWrite } - w.Err = err } return }