From cbbbff3c723dcf00a2d9b6746907ab18b0970672 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 18 Feb 2025 01:51:17 +0800 Subject: git_hooks_client.c: Allow ECONNRESET when splicing sock -> stderr Not exactly sure what's happening, but it looks like conn.Close() in Go sometimes produces an ECONNRESET in here. --- git_hooks_client/git_hooks_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git_hooks_client') diff --git a/git_hooks_client/git_hooks_client.c b/git_hooks_client/git_hooks_client.c index 541e606..b5e4ed8 100644 --- a/git_hooks_client/git_hooks_client.c +++ b/git_hooks_client/git_hooks_client.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -185,7 +186,7 @@ int main(int argc, char *argv[]) { ssize_t stderr_bytes_spliced; while ((stderr_bytes_spliced = splice(sock, NULL, STDERR_FILENO, NULL, stderr_pipe_size, SPLICE_F_MORE)) > 0) { } - if (stdin_bytes_spliced == -1) { + if (stdin_bytes_spliced == -1 && errno != ECONNRESET) { perror("splice internal socket to stderr"); close(sock); return EXIT_FAILURE; -- cgit v1.2.3