aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_client/git_hooks_client.c
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-18 01:51:17 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-18 01:51:17 +0800
commitcbbbff3c723dcf00a2d9b6746907ab18b0970672 (patch)
tree0cb517471f7549e44232c6e2813930d9d587c0f8 /git_hooks_client/git_hooks_client.c
parentRevert "style.css: Make it more concise" (diff)
downloadforge-cbbbff3c723dcf00a2d9b6746907ab18b0970672.tar.gz
forge-cbbbff3c723dcf00a2d9b6746907ab18b0970672.tar.zst
forge-cbbbff3c723dcf00a2d9b6746907ab18b0970672.zip
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.
Diffstat (limited to 'git_hooks_client/git_hooks_client.c')
-rw-r--r--git_hooks_client/git_hooks_client.c3
1 files changed, 2 insertions, 1 deletions
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 <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -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;