chiark / gitweb /
dgit: libcurl usage: Install SIGPIPE handler ourselv
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 4a5cae1d37c3bdbbcd733b3887af67da00cdfd6b..5bd648a2b14447fef2919e582f02c25e6d189537 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -54,6 +54,8 @@ use Debian::Dgit;
 our $our_version = 'UNRELEASED'; ###substituted###
 our $absurdity = undef; ###substituted###
 
+$SIG{INT} = 'DEFAULT'; # work around #932841
+
 our @rpushprotovsn_support = qw(6 5 4); # Reverse order!
 our $protovsn;
 
@@ -1207,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]+)/#) {
@@ -1217,6 +1220,10 @@ 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