summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:51:55 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:51:55 +0200
commit6ac27e73bd00d18fedd9998efef17a98c10fc14a (patch)
tree66991df6feea494cad861cff412a1a0a3f5a0d40 /apt-pkg
parenta38e550586af7f80570cfaff8cf4c83bce8cf9b9 (diff)
cherry pick fix for verification of empty Packages files from the mvo branch
Diffstat (limited to 'apt-pkg')
-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 4a8f7749d..d83ccf322 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