summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2011-05-31 10:56:06 +0200
committerMichael Vogt <mvo@debian.org>2011-05-31 10:56:06 +0200
commit2e87f99f83b201f9c20d925e798f762f339f6b2c (patch)
tree9b0d90834d51e7a28d6a122f433ae91b07f4ad69
parent4fdb612374655361c8923a4611db6a0d10054317 (diff)
parenta0c3110e038a5186d9b108ccea06fb00619436f0 (diff)
merge from lp:~mvo/apt/mvo
-rw-r--r--apt-pkg/acquire-item.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 998c42dc4..c3817f6ee 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -910,17 +910,20 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
pkgTagSection sec;
pkgTagFile tag(&fd);
- if (_error->PendingError() || !tag.Step(sec)) {
- Status = StatError;
- _error->DumpErrors();
- Rename(DestFile,DestFile + ".FAILED");
- return;
- } else if (!sec.Exists("Package")) {
- Status = StatError;
- ErrorText = ("Encountered a section with no Package: header");
- Rename(DestFile,DestFile + ".FAILED");
- return;
- }
+ // Only test for correctness if the file is not empty (empty is ok)
+ if (fd.Size() > 0) {
+ if (_error->PendingError() || !tag.Step(sec)) {
+ Status = StatError;
+ _error->DumpErrors();
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ } else if (!sec.Exists("Package")) {
+ Status = StatError;
+ ErrorText = ("Encountered a section with no Package: header");
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ }
+ }
}
// Done, move it into position