]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/hex: add error check for write error.
authorRui Ueyama <ruiu@google.com>
Mon, 17 Mar 2014 19:07:30 +0000 (12:07 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 17 Mar 2014 19:07:30 +0000 (12:07 -0700)
I believe the original author of this code just forgot to check for error here.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/76760043

src/pkg/encoding/hex/hex.go

index 167d00e032aec9a56be8fb728fc415426d54bdc4..d1fc7024a97fa24c0ea8b096dfb5a7d144550848 100644 (file)
@@ -146,6 +146,9 @@ func (h *dumper) Write(data []byte) (n int, err error) {
                        h.buf[12] = ' '
                        h.buf[13] = ' '
                        _, err = h.w.Write(h.buf[4:])
+                       if err != nil {
+                               return
+                       }
                }
                Encode(h.buf[:], data[i:i+1])
                h.buf[2] = ' '