summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debindexfile.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-11-15 10:28:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-11-15 10:28:27 +0100
commit58a642755c63cde3cf377d3719d66add27b13d65 (patch)
tree92719b94ccca55b5e128f28e9499e1ec331a5440 /apt-pkg/deb/debindexfile.cc
parentfd8bb61d2945d2e2f19f0e0a753129235717a9f3 (diff)
parent3cf1e4b50a9bb439c4f54a631cfebbb6c4d1ea7d (diff)
merged from debian
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r--apt-pkg/deb/debindexfile.cc44
1 files changed, 35 insertions, 9 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index a89a2574f..af1209ccb 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -149,11 +149,20 @@ bool debSourcesIndex::Exists() const
/* */
unsigned long debSourcesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
@@ -269,11 +278,20 @@ bool debPackagesIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debPackagesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
// PackagesIndex::Merge - Load the index file into a cache /*{{{*/
@@ -460,12 +478,20 @@ bool debTranslationsIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debTranslationsIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
- return f.Size();
+ return size;
}
/*}}}*/
// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/