aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_client
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-18 02:01:23 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-18 02:01:23 +0800
commite67be314953bc10ccdf6396d87edf338cb18ad11 (patch)
tree61aee1f39f3b52665a5f5df7e62b61b81670b18d /git_hooks_client
parentgit_hooks_client.c: Allow ECONNRESET when splicing sock -> stderr (diff)
downloadforge-e67be314953bc10ccdf6396d87edf338cb18ad11.tar.gz
forge-e67be314953bc10ccdf6396d87edf338cb18ad11.tar.zst
forge-e67be314953bc10ccdf6396d87edf338cb18ad11.zip
git_hooks_client.c: Ignore SIGPIPE
Diffstat (limited to 'git_hooks_client')
-rw-r--r--git_hooks_client/git_hooks_client.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/git_hooks_client/git_hooks_client.c b/git_hooks_client/git_hooks_client.c
index b5e4ed8..e00ab3a 100644
--- a/git_hooks_client/git_hooks_client.c
+++ b/git_hooks_client/git_hooks_client.c
@@ -8,8 +8,14 @@
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
+#include <signal.h>
int main(int argc, char *argv[]) {
+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
+ perror("signal");
+ return EXIT_FAILURE;
+ }
+
const char *socket_path = getenv("LINDENII_FORGE_HOOKS_SOCKET_PATH");
if (socket_path == NULL) {
dprintf(STDERR_FILENO, "environment variable LINDENII_FORGE_HOOKS_SOCKET_PATH undefined\n");