]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
SmartConfigure and SmartUnPack have got smarter! The full descriptions of what they...
[apt.git] / apt-pkg / acquire-item.cc
index 998c42dc4a31dd5c063570a2fa0297a1147b7389..c3817f6ee08231591dea0e4212e1d0f8ff5e2535 100644 (file)
@@ -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