diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:24 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:24 +0000 |
commit | a005475ea62b65e08f67bf462ace6eb44289df07 (patch) | |
tree | 94948e5728ab68a2d70d381d4bb5093c7ddf7d49 /apt-pkg/algorithms.cc | |
parent | ddc1d8d08eaff6c71c6062654ddd9d8981799ae9 (diff) |
Fixed the infinite loop problem
Author: jgg
Date: 1999-07-30 02:54:25 GMT
Fixed the infinite loop problem
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r-- | apt-pkg/algorithms.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index fed9b0be7..d84ce2e21 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.cc,v 1.22 1999/07/20 05:53:33 jgg Exp $ +// $Id: algorithms.cc,v 1.23 1999/07/30 02:54:25 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -340,6 +340,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache) // We loop indefinately to get the minimal set size. bool Change = false; + unsigned int Count = 0; do { Change = false; @@ -348,16 +349,21 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache) // Not interesting if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true) continue; - + // Keep it and see if that is OK Cache.MarkKeep(I); if (Cache.BrokenCount() != 0) Cache.MarkInstall(I,false); else - Change = true; + { + // If keep didnt actually do anything then there was no change.. + if (Cache[I].Upgrade() == false) + Change = true; + } } + Count++; } - while (Change == true); + while (Change == true && Count < 10); if (Cache.BrokenCount() != 0) return _error->Error("Internal Error in pkgMinimizeUpgrade"); |