Просмотр исходного кода

* methods/rred.cc:
- use the patchfile modification time instead of the one from the
"old" file - thanks to Philipp Weis for noticing! (Closes: #571541)

David Kalnischkies лет назад: 16
Родитель
Сommit
1082d4c7ad
2 измененных файлов с 14 добавлено и 8 удалено
  1. 3 0
      debian/changelog
  2. 11 8
      methods/rred.cc

+ 3 - 0
debian/changelog

@@ -57,6 +57,9 @@ apt (0.7.26~exp4) UNRELEASED; urgency=low
   * apt-pkg/pkgcache.h:
     - enhance the Groups ABI by providing a ID as the other structs does
     - check also the size of the Group struct then checking for the others
+  * methods/rred.cc:
+    - use the patchfile modification time instead of the one from the
+      "old" file - thanks to Philipp Weis for noticing! (Closes: #571541)
 
   [ Jari Aalto ]
   * cmdline/apt-get.cc:

+ 11 - 8
methods/rred.cc

@@ -477,23 +477,26 @@ bool RredMethod::Fetch(FetchItem *Itm)						/*{{{*/
    Patch.Close();
    To.Close();
 
-   // Transfer the modification times
-   struct stat Buf;
-   if (stat(Path.c_str(),&Buf) != 0)
+   /* Transfer the modification times from the patch file
+      to be able to see in which state the file should be
+      and use the access time from the "old" file */
+   struct stat BufBase, BufPatch;
+   if (stat(Path.c_str(),&BufBase) != 0 ||
+       stat(string(Path+".ed").c_str(),&BufPatch) != 0)
       return _error->Errno("stat",_("Failed to stat"));
 
    struct utimbuf TimeBuf;
-   TimeBuf.actime = Buf.st_atime;
-   TimeBuf.modtime = Buf.st_mtime;
+   TimeBuf.actime = BufBase.st_atime;
+   TimeBuf.modtime = BufPatch.st_mtime;
    if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0)
       return _error->Errno("utime",_("Failed to set modification time"));
 
-   if (stat(Itm->DestFile.c_str(),&Buf) != 0)
+   if (stat(Itm->DestFile.c_str(),&BufBase) != 0)
       return _error->Errno("stat",_("Failed to stat"));
 
    // return done
-   Res.LastModified = Buf.st_mtime;
-   Res.Size = Buf.st_size;
+   Res.LastModified = BufBase.st_mtime;
+   Res.Size = BufBase.st_size;
    Res.TakeHashes(Hash);
    URIDone(Res);