X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f330c0f347619f72766069acdc24616ec5fe7147..8f8ed8f4e50fd98aa43ee69971cac8bda55760f1:/apt-pkg/contrib/fileutl.cc diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 6a621e2a9..50019872e 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -42,6 +42,11 @@ #include #include #include + +#include +#ifdef WORDS_BIGENDIAN +#include +#endif /*}}}*/ using namespace std; @@ -62,6 +67,15 @@ bool RunScripts(const char *Cnf) // This is the child if (Child == 0) { + if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") + { + std::cerr << "Chrooting into " + << _config->FindDir("DPkg::Chroot-Directory") + << std::endl; + if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0) + _exit(100); + } + if (chdir("/tmp/") != 0) _exit(100); @@ -967,8 +981,10 @@ unsigned long FileFd::Size() return _error->Errno("read","Unable to read original size of gzipped file"); #ifdef WORDS_BIGENDIAN - unsigned char const * const p = (unsigned char *) &size; - size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + uint32_t tmp_size = size; + uint8_t const * const p = (uint8_t const * const) &tmp_size; + tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + size = tmp_size; #endif if (lseek(iFd, orig_pos, SEEK_SET) < 0)