summaryrefslogtreecommitdiff
path: root/cmdline/apt-mark.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-08-22 23:00:31 +0200
committerMichael Vogt <mvo@debian.org>2013-08-22 23:00:31 +0200
commit6fd51a5f4300f4b1563cdf2a34f59e6bbaacb838 (patch)
tree6469d9c9f58ebce2557a9689b8907752990734b3 /cmdline/apt-mark.cc
parent329dea2d39d2518e43f0761c1c89990857e197ad (diff)
parent2510eea4a0922b7b6da8099deb70ca87851633ce (diff)
Merge branch 'debian/sid' of ssh://git.debian.org/git/apt/apt into debian/sid
Diffstat (limited to 'cmdline/apt-mark.cc')
-rw-r--r--cmdline/apt-mark.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index eb3410be1..ebb1f9892 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -209,7 +209,7 @@ bool DoHold(CommandLine &CmdL)
dup2(nullfd, STDIN_FILENO);
dup2(nullfd, STDOUT_FILENO);
dup2(nullfd, STDERR_FILENO);
- if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
+ if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0)
_error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --assert-multi-arch", chrootDir.c_str());
execvp(Args[0], (char**) &Args[0]);
_error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!");
@@ -279,7 +279,7 @@ bool DoHold(CommandLine &CmdL)
{
close(external[1]);
std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory");
- if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
+ if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 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(external[0], STDIN_FILENO);