chiark / gitweb /
git-cache-proxy: Move $SIG{ALRM} setting to global
[chiark-utils.git] / scripts / git-cache-proxy
index 051888a9682bd49df717e155605d126562068395..518ca9a8fe8c34b816b34e1a0dd3b176e703bbbc 100755 (executable)
@@ -145,6 +145,8 @@ sub fail ($) {
     exit 0;
 }
 
+$SIG{ALRM} = sub { fail "timeout" };
+
 sub gitfail ($) {
     my ($msg) = @_;
     close LOCK;
@@ -251,7 +253,6 @@ sub servinfo ($) {
 }
 
 sub readcommand () {
-    $SIG{ALRM} = sub { fail "timeout" };
     alarm 30;
 
     my $hex_len = xread 4;