From: Ian Jackson Date: Tue, 23 Jul 2019 17:22:26 +0000 (+0100) Subject: dgit: libcurl usage: Install SIGPIPE handler ourselv X-Git-Tag: archive/debian/9.6~9 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=230d9f8ed1dd3f9e4ee4351af34e4bcb52c54ac8;p=dgit.git dgit: libcurl usage: Install SIGPIPE handler ourselv We don't want a global SIGPIPE setting. In particular we do not want to run any of subprocesses with SIGPIPE ignored. Just in case libcurl gets this wrong, tell it CURLOPT_NOSIGNAL, and do it ourselves. Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index 696978b2..5bd648a2 100755 --- a/dgit +++ b/dgit @@ -1209,6 +1209,7 @@ sub archive_api_query_curl ($) { my $response_body; $setopt->(CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS|CURLPROTO_HTTP); $setopt->(CURLOPT_URL, $url); + $setopt->(CURLOPT_NOSIGNAL, 1); $setopt->(CURLOPT_WRITEDATA, \$response_body); if ($url =~ m#^https://([-.0-9a-z]+)/#) { @@ -1221,6 +1222,8 @@ sub archive_api_query_curl ($) { printdebug "archive api query: fetching $url...\n"; + local $SIG{PIPE} = 'IGNORE'; + my $x = $curl->perform(); fail f_ "fetch of %s failed (%s): %s", $url, $curl->strerror($x), $curl->errbuf