summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-13 10:06:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-13 10:06:55 +0000
commitc6fdae076c296fc717c33b6bb2fb84d586bbf125 (patch)
tree19ef48f25d23cc3334cd0b1073d48b90076a1e87
parent7bc61a82411b425ac3e7fee85cf236583099e687 (diff)
downloadurpmi-c6fdae076c296fc717c33b6bb2fb84d586bbf125.tar
urpmi-c6fdae076c296fc717c33b6bb2fb84d586bbf125.tar.gz
urpmi-c6fdae076c296fc717c33b6bb2fb84d586bbf125.tar.bz2
urpmi-c6fdae076c296fc717c33b6bb2fb84d586bbf125.tar.xz
urpmi-c6fdae076c296fc717c33b6bb2fb84d586bbf125.zip
don't clean obsolete headers in cache if cache is empty
-rw-r--r--urpm.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/urpm.pm b/urpm.pm
index e9e6e39e..c9470df5 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1904,13 +1904,15 @@ sub remove_obsolete_headers_in_cache {
}
closedir $dh;
}
- $urpm->{log}(N("found %d headers in cache", scalar(keys %headers)));
- foreach (@{$urpm->{depslist}}) {
- delete $headers{$_->fullname};
- }
- $urpm->{log}(N("removing %d obsolete headers in cache", scalar(keys %headers)));
- foreach (values %headers) {
- unlink "$urpm->{cachedir}/headers/$_";
+ if (%headers) {
+ $urpm->{log}(N("found %d headers in cache", scalar(keys %headers)));
+ foreach (@{$urpm->{depslist}}) {
+ delete $headers{$_->fullname};
+ }
+ $urpm->{log}(N("removing %d obsolete headers in cache", scalar(keys %headers)));
+ foreach (values %headers) {
+ unlink "$urpm->{cachedir}/headers/$_";
+ }
}
}