]> git.saurik.com Git - apt.git/blobdiff - methods/https.cc
correct some style/performance/warnings from cppcheck
[apt.git] / methods / https.cc
index 2a562434b42dab471ae732be2e045a607a6b1957..e16e363397e0c874d5e52735e5fde22eecabc949 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <sys/stat.h>
 #include <sys/time.h>
-#include <utime.h>
 #include <unistd.h>
 #include <signal.h>
 #include <stdio.h>
@@ -405,10 +404,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    curl_easy_getinfo(curl, CURLINFO_FILETIME, &Res.LastModified);
    if (Res.LastModified != -1)
    {
-      struct utimbuf UBuf;
-      UBuf.actime = Res.LastModified;
-      UBuf.modtime = Res.LastModified;
-      utime(File->Name().c_str(),&UBuf);
+      struct timespec times[2];
+      times[0].tv_sec = Res.LastModified;
+      times[1].tv_sec = Res.LastModified;
+      times[0].tv_nsec = times[1].tv_nsec = 0;
+      futimens(File->Fd(), times);
    }
    else
       Res.LastModified = resultStat.st_mtime;