From cbbbff3c723dcf00a2d9b6746907ab18b0970672 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 18 Feb 2025 01:51:17 +0800 Subject: [PATCH] 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 ++- diff --git a/git_hooks_client/git_hooks_client.c b/git_hooks_client/git_hooks_client.c index 541e606b79f79c877f713a2c05f8c738ac65201f..b5e4ed809f8602d735b86feeed85842e569afe6a 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 @@ */ 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; -- 2.48.1