]> Cypherpunks repositories - gostls13.git/commit
io: add error check on pipe close functions to avoid error overwriting
authorJordi Martin <jordimartin@gmail.com>
Wed, 7 Aug 2019 11:14:38 +0000 (11:14 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 28 Aug 2019 18:35:24 +0000 (18:35 +0000)
commitf45eb9ff3c96dfd951c65d112d033ed7b5e02432
tree1f4020a09d707b03125802fcf5009d7df4907e8a
parent89865f8ba64ccb27f439cce6daaa37c9aa38f351
io: add error check on pipe close functions to avoid error overwriting

The current implementation allows multiple calls `Close` and `CloseWithError` in every side of the pipe, as a result, the original error can be overwritten.

This CL fixes this behavior adding an error existence check on `atomicError` type
and keeping the first error still available.

Fixes #24283

Change-Id: Iefe8f758aeb775309424365f8177511062514150
GitHub-Last-Rev: b559540d7af3a0dad423816b695525ac2d6bd864
GitHub-Pull-Request: golang/go#33239
Reviewed-on: https://go-review.googlesource.com/c/go/+/187197
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/io/pipe.go
src/io/pipe_test.go