]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.cc
* apt-pkg/contrib/fileutl.{cc,h}:
[apt.git] / apt-pkg / contrib / fileutl.cc
index 24e3f08d9367ea6f97de2915b5ba60465de55cc4..85dc6f6006a7ed963dd017459b8c19e65bf442ac 100644 (file)
@@ -43,7 +43,8 @@
 #include <set>
 #include <algorithm>
 
 #include <set>
 #include <algorithm>
 
-#ifndef WORDS_BIGENDIAN
+#include <config.h>
+#ifdef WORDS_BIGENDIAN
 #include <inttypes.h>
 #endif
                                                                        /*}}}*/
 #include <inttypes.h>
 #endif
                                                                        /*}}}*/
@@ -66,6 +67,15 @@ bool RunScripts(const char *Cnf)
    // This is the child
    if (Child == 0)
    {
    // 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);
         
       if (chdir("/tmp/") != 0)
         _exit(100);
         
@@ -436,6 +446,17 @@ string SafeGetCWD()
    return S;
 }
                                                                        /*}}}*/
    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                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // flNotDir - Strip the directory from the filename                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */