From 2510eea4a0922b7b6da8099deb70ca87851633ce Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Aug 2013 22:30:20 +0200 Subject: do chdir("/") after chroot() --- apt-pkg/aptconfiguration.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/aptconfiguration.cc') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index e32e553a4..4f9b84e00 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -392,7 +392,7 @@ std::vector const Configuration::getArchitectures(bool const &Cache dup2(nullfd, STDIN_FILENO); dup2(external[1], 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 --print-foreign-architectures", chrootDir.c_str()); execvp(Args[0], (char**) &Args[0]); _error->WarningE("getArchitecture", "Can't detect foreign architectures supported by dpkg!"); -- cgit v1.2.3