summaryrefslogtreecommitdiff
path: root/src/pkg/crypto/cipher
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2013-01-21 11:22:08 -0500
committerAdam Langley <agl@golang.org>2013-01-21 11:22:08 -0500
commit0e8485f3c04c3becaa168a0652711a4b1f2f7aa4 (patch)
treec1ee2dcc790f4d22f1880f5fd1f38e8a98ca8962 /src/pkg/crypto/cipher
parente619b64749ef1e4d3622b34b71a5ae56452a2539 (diff)
downloadgo-0e8485f3c04c3becaa168a0652711a4b1f2f7aa4.tar.gz
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 issue 4657. R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/7161043
Diffstat (limited to 'src/pkg/crypto/cipher')
-rw-r--r--src/pkg/crypto/cipher/io.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/pkg/crypto/cipher/io.go b/src/pkg/crypto/cipher/io.go
index 76048fbf3..807e8daea 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
}