Просмотр исходного кода

update: Check if the cache could be opened, don't just assume it

This seems to cause Bug#756162, as in that case the depcache
was NULL.

I'm not entirely sure how that happens, but it's better to
be check here rather then crash later on.

Closes: #756162
Julian Andres Klode лет назад: 11
Родитель
Сommit
7a139fa8bf
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      apt-private/private-update.cc

+ 2 - 1
apt-private/private-update.cc

@@ -84,7 +84,8 @@ bool DoUpdate(CommandLine &CmdL)
    if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true)
    if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true)
    {
    {
       int upgradable = 0;
       int upgradable = 0;
-      Cache.Open();
+      if (Cache.Open() == false)
+         return false;
       for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
       for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
       {
       {
          pkgDepCache::StateCache &state = Cache[I];
          pkgDepCache::StateCache &state = Cache[I];