X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/42f45a9a98ee298cfdd301d16a39b0094f6ff9d5..2ec858bc68bc2d79ec020fe24be2d76b7c5b6792:/apt-pkg/contrib/fileutl.cc?ds=sidebyside diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 767951daf..85dc6f600 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -67,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); @@ -437,6 +446,17 @@ string SafeGetCWD() return S; } /*}}}*/ +// GetModificationTime - Get the mtime of the given file or -1 on error /*{{{*/ +// --------------------------------------------------------------------- +/* We return / on failure. */ +time_t GetModificationTime(string const &Path) +{ + struct stat St; + if (stat(Path.c_str(), &St) < 0) + return -1; + return St.st_mtime; +} + /*}}}*/ // flNotDir - Strip the directory from the filename /*{{{*/ // --------------------------------------------------------------------- /* */