]> git.saurik.com Git - apt.git/blobdiff - methods/rred.cc
use utimes instead of utimensat/futimens
[apt.git] / methods / rred.cc
index f7dac3c191f8a89f8038fbaabe52881fe19c3221..fe7ef7322a40d0c08397f8501fc85e347c85889a 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 
 #include <apti18n.h>
 
@@ -597,12 +598,12 @@ class RredMethod : public pkgAcqMethod {
               stat(patch_name.c_str(), &bufpatch) != 0)
            return _error->Errno("stat", _("Failed to stat"));
 
-        struct timespec times[2];
+        struct timeval times[2];
         times[0].tv_sec = bufbase.st_atime;
         times[1].tv_sec = bufpatch.st_mtime;
-        times[0].tv_nsec = times[1].tv_nsec = 0;
-        if (utimensat(AT_FDCWD, Itm->DestFile.c_str(), times, 0) != 0)
-           return _error->Errno("utimensat",_("Failed to set modification time"));
+        times[0].tv_usec = times[1].tv_usec = 0;
+        if (utimes(Itm->DestFile.c_str(), times) != 0)
+           return _error->Errno("utimes",_("Failed to set modification time"));
 
         if (stat(Itm->DestFile.c_str(), &bufbase) != 0)
            return _error->Errno("stat", _("Failed to stat"));