Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-22 09:44:43 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-22 10:49:44 +0300
commitf0d3ef2667e5f0a9931cb01d3034707f544ea582 (patch)
treeaf5c328dd6bb9bdb2afdc36e9dbeeafbc88cd133
parent80ece368b1a99c40c9af8212e0442e940dc93ac9 (diff)
gitaly-hooks: Propagate errors when closing fails
The send function used to relay stdin from Git to the hook service doesn't check the error code returned by `CloseSend()`. Fix this by returning its error in case `io.Copy()` didn't return an error.
-rw-r--r--cmd/gitaly-hooks/hooks.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go
index f979c9d7e..b9dda11d7 100644
--- a/cmd/gitaly-hooks/hooks.go
+++ b/cmd/gitaly-hooks/hooks.go
@@ -190,8 +190,12 @@ func gitPushOptions() []string {
func sendFunc(reqWriter io.Writer, stream grpc.ClientStream, stdin io.Reader) func(errC chan error) {
return func(errC chan error) {
_, errSend := io.Copy(reqWriter, stdin)
- stream.CloseSend()
- errC <- errSend
+ errClose := stream.CloseSend()
+ if errSend != nil {
+ errC <- errSend
+ } else {
+ errC <- errClose
+ }
}
}