]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-mark.cc
check build-dep candidate if install is forbidden
[apt.git] / cmdline / apt-mark.cc
index b067413e3d4d6f5a60221b9ee3bb5a9fee299c66..2d5eed29d273d4d0e21ef98f9645b64b630e44d6 100644 (file)
@@ -220,7 +220,7 @@ bool DoHold(CommandLine &CmdL)
 
    bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0;
 
-   for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end();)
    {
       if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold)
       {
@@ -228,9 +228,10 @@ bool DoHold(CommandLine &CmdL)
            ioprintf(c1out,_("%s was already set on hold.\n"), Pkg.FullName(true).c_str());
         else
            ioprintf(c1out,_("%s was already not hold.\n"), Pkg.FullName(true).c_str());
-        pkgset.erase(Pkg);
-        continue;
+        Pkg = pkgset.erase(Pkg, true);
       }
+      else
+        ++Pkg;
    }
 
    bool dpkgMultiArch = false;
@@ -279,8 +280,8 @@ bool DoHold(CommandLine &CmdL)
       if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
         _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --set-selections", chrootDir.c_str());
       int const nullfd = open("/dev/null", O_RDONLY);
-      dup2(nullfd, STDIN_FILENO);
-      dup2(external[0], STDOUT_FILENO);
+      dup2(external[0], STDIN_FILENO);
+      dup2(nullfd, STDOUT_FILENO);
       dup2(nullfd, STDERR_FILENO);
       execvp(Args[0], (char**) &Args[0]);
       _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!");
@@ -359,7 +360,7 @@ bool ShowHold(CommandLine &CmdL)
 /* */
 bool ShowHelp(CommandLine &CmdL)
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
            COMMON_ARCH,__DATE__,__TIME__);
 
    cout <<