summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-05-04 16:10:47 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-05-04 16:10:47 +0200
commit1082d4c7ad98c091688bdeb427e48913d1327279 (patch)
tree04eee94b791ba45d35d078e5d73fc3b2470266db /methods
parentb81dbe40d48ce6fcf76a4df1eab6f9b0905962e2 (diff)
* methods/rred.cc:
- use the patchfile modification time instead of the one from the "old" file - thanks to Philipp Weis for noticing! (Closes: #571541)
Diffstat (limited to 'methods')
-rw-r--r--methods/rred.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/methods/rred.cc b/methods/rred.cc
index 262c78cab..f42c7a072 100644
--- a/methods/rred.cc
+++ b/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);