X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=scripts%2Fgit-cache-proxy;h=647f6b60d3c152dae98a16240f0bf9181dcee86b;hp=0c6ba556d4909dd70b3b7dd3c8ff01a001759bc4;hb=a14cb06ac8fff27e407a39993b2b20f9a7109f7c;hpb=0551f3103af1b31e4cf03bd81c191f34837ef7d1 diff --git a/scripts/git-cache-proxy b/scripts/git-cache-proxy index 0c6ba55..647f6b6 100755 --- a/scripts/git-cache-proxy +++ b/scripts/git-cache-proxy @@ -29,7 +29,8 @@ # git-cache-proxy # Copyright 2010 Tony Finch -# Copyright 2013 Ian Jackson +# Copyright 2013,2014 Ian Jackson +# Copyright 2017 Citrix # # git-cache-proxy is free software; you can redistribute it and/or # modify them under the terms of the GNU General Public License as @@ -360,6 +361,7 @@ sub clonefetch () { servinfo "fetch/clone failed: $fetchfail"; } } + alarm 0; if (!$exists) { rename $tmpd, $gitd or fail "rename fresh $tmpd to $gitd: $!"; @@ -415,14 +417,11 @@ sub housekeeping () { die "$dir: cannot rename to $tdir: $!\n"; } } - my $errs; - remove_tree($tdir, { safe=>1, error=>\$errs }); - if (!stat $tdir) { - foreach my $err (@$errs) { - my ($file, $message) = %$err; - logm 'info', "problem deleting: $file: $message"; - } - die "$dir: problem deleting file(s)\n"; + system qw(rm -rf --), $tdir; + if (stat $tdir) { + die "$dir: problem deleting file(s), rm exited $?\n"; + } elsif ($! != ENOENT) { + die "$tdir: cannot stat after deletion: $!\n"; } } }; @@ -459,8 +458,10 @@ sub housekeepingcheck ($$) { } if ($dofork) { my $child = fork; - defined $child or hkfail "fork: $!"; + defined $child or fail "fork: $!"; if (!$child) { + open STDERR, "|logger -p daemon.warning -t '$us(housekeeping)'" + or die "fork: logger $!"; housekeeping(); exit 0; }