From: Eric Wong Date: Mon, 7 Mar 2016 19:10:33 +0000 (+0000) Subject: git-http-backend: check EINTR as well as EAGAIN X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae7ebaccbea5f6f3fa10ef1fa8cb293babf0a831;p=thirdparty%2Fpublic-inbox.git git-http-backend: check EINTR as well as EAGAIN The blocking PSGI server may cause EINTR to be hit, here. --- diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index 989dac7f7..d0ce80bc5 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -193,18 +193,18 @@ sub serve_smart { } }; my $fail = sub { - my ($e) = @_; - if ($e eq 'EAGAIN') { + if ($!{EAGAIN} || $!{EINTR}) { select($vin, undef, undef, undef) if defined $vin; # $vin is undef on async, so this is a noop on EAGAIN return; } + my $e = $!; $end->(); $err->print("git http-backend ($git_dir): $e\n"); }; my $cb = sub { # read git-http-backend output and stream to client my $r = $rpipe ? $rpipe->sysread($buf, 8192, length($buf)) : 0; - return $fail->($!{EAGAIN} ? 'EAGAIN' : $!) unless defined $r; + return $fail->() unless defined $r; return $end->() if $r == 0; # EOF if ($fh) { # stream body from git-http-backend to HTTP client $fh->write($buf);