]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.cc
merged from donkult
[apt.git] / apt-pkg / cacheset.cc
index b892ab4bfd9a69964c3c0762d63c4e187347f7d2..e2dbe0e5776e28259c006d3fc893c566cba36acc 100644 (file)
@@ -217,6 +217,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
                                                        pkgCacheFile &Cache, const char * cmdline,
                                                        std::list<Modifier> const &mods, CacheSetHelper &helper) {
        std::string str = cmdline;
+       unsigned short fallback = modID;
        bool modifierPresent = false;
        for (std::list<Modifier>::const_iterator mod = mods.begin();
             mod != mods.end(); ++mod) {
@@ -243,6 +244,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
                helper.showErrors(errors);
                if (Pkg.end() == false) {
                        pci->insert(Pkg);
+                       modID = fallback;
                        return true;
                }
        }
@@ -281,13 +283,14 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
                modifierPresent = true;
                break;
        }
-
        if (modifierPresent == true) {
                bool const errors = helper.showErrors(false);
                bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
                helper.showErrors(errors);
-               if (found == true)
+               if (found == true) {
+                       modID = fallback;
                        return true;
+               }
        }
        return FromString(vci, Cache, str, select, helper);
 }