diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-01-29 13:10:38 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-01-29 13:10:38 +0100 |
commit | 734a6727696b42d5351f41b5b33ec767ccbd5db6 (patch) | |
tree | c288bec755928979f0c6a1581e95f54e9ae26f38 /apt-pkg/deb/dpkgpm.cc | |
parent | e6ee75afbd4277df7bb2f5dc9ea03c18aecd3986 (diff) | |
download | apt-734a6727696b42d5351f41b5b33ec767ccbd5db6.tar.gz |
ensure that dpkg binary doesn't have the chroot-directory prefixed
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 4c473c1c2..51e896a4a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -836,7 +836,17 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Generate the base argument list for dpkg std::vector<const char *> Args; unsigned long StartSize = 0; - string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg"); + string Tmp = _config->Find("Dir::Bin::dpkg","dpkg"); + { + string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/"); + size_t dpkgChrootLen = dpkgChrootDir.length(); + if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0) + { + if (dpkgChrootDir[dpkgChrootLen - 1] == '/') + --dpkgChrootLen; + Tmp = Tmp.substr(dpkgChrootLen); + } + } Args.push_back(Tmp.c_str()); StartSize += Tmp.length(); |