diff options
author | Daniel Nicoletti <dantti12@gmail.com> | 2012-04-17 04:25:36 -0300 |
---|---|---|
committer | Daniel Nicoletti <dantti12@gmail.com> | 2012-04-17 04:25:36 -0300 |
commit | 687775d5d4adc777939e5fe87e753a2d61f64faf (patch) | |
tree | 4df5bc48e9d3fddb2ebad49492e08188bad879d4 | |
parent | cfb310be151e667359bd4fcf78081e53764da00e (diff) |
aptcc: Make sure we discard errors when closing the cache
-rw-r--r-- | backends/aptcc/AptCacheFile.cpp | 15 | ||||
-rw-r--r-- | backends/aptcc/apt-intf.cpp | 1 |
2 files changed, 7 insertions, 9 deletions
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp index fcab43a3..556323a4 100644 --- a/backends/aptcc/AptCacheFile.cpp +++ b/backends/aptcc/AptCacheFile.cpp @@ -26,15 +26,11 @@ AptCacheFile::AptCacheFile(PkBackend *backend) : m_packageRecords(0) { - std::cout << "AptCacheFile::AptCacheFile()" << std::endl; } AptCacheFile::~AptCacheFile() { - std::cout << "AptCacheFile::~AptCacheFile()" << std::endl; - - delete m_packageRecords; - pkgCacheFile::Close(); + Close(); } bool AptCacheFile::Open(bool withLock) @@ -44,12 +40,15 @@ bool AptCacheFile::Open(bool withLock) void AptCacheFile::Close() { - if (m_packageRecords) { - delete m_packageRecords; - } + delete m_packageRecords; + m_packageRecords = 0; pkgCacheFile::Close(); + + // Discard all errors to avoid a future failure when opening + // the package cache + _error->Discard(); } bool AptCacheFile::BuildCaches(bool withLock) diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp index aa2bc3e9..3bcba8a5 100644 --- a/backends/aptcc/apt-intf.cpp +++ b/backends/aptcc/apt-intf.cpp @@ -96,7 +96,6 @@ bool AptIntf::init() // Tries to open the cache bool ret; ret = m_cache.Open(); - cout << "AptIntf::init() " << ret << endl; return !ret; } |