From 0ce8041569b49ef7b16486fbd04798c3e548790b Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 7 Apr 2021 16:40:38 +0000 Subject: [PATCH] In some cases the http process terminates and Theo's and my theory is that this is caused by a SIGPIPE. So add a handler that will abort the process and dump core. OK deraadt@ --- usr.sbin/rpki-client/http.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index 250ba22de4c..b3d23cfcfd8 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.20 2021/04/07 16:06:37 deraadt Exp $ */ +/* $OpenBSD: http.c,v 1.21 2021/04/07 16:40:38 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -1140,6 +1141,13 @@ http_do(struct http_connection *conn) return 0; } +static void +gotpipe(int sig __attribute__((unused))) +{ + warnx("http: unexpected sigpipe\n"); + kill(getpid(), SIGABRT); +} + void proc_http(char *bind_addr, int fd) { @@ -1148,6 +1156,9 @@ proc_http(char *bind_addr, int fd) size_t i; int active_connections; + /* XXX for now track possible SIGPIPE */ + signal(SIGPIPE, gotpipe); + if (bind_addr != NULL) { struct addrinfo hints, *res; -- 2.20.1