~ubuntu-branches/ubuntu/trusty/apt/trusty

« back to all changes in this revision

Viewing changes to methods/copy.cc

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-02-07 21:03:22 UTC
  • mfrom: (1.4.80 sid)
  • Revision ID: package-import@ubuntu.com-20140207210322-s7f833aga98ibdkm
Tags: 0.9.15.1ubuntu1
mergedĀ fromĀ debian/sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <apt-pkg/hashes.h>
19
19
 
20
20
#include <sys/stat.h>
21
 
#include <utime.h>
22
21
#include <unistd.h>
23
22
#include <apti18n.h>
24
23
                                                                        /*}}}*/
71
70
   }
72
71
 
73
72
   From.Close();
 
73
 
 
74
   // Transfer the modification times
 
75
   struct timespec times[2];
 
76
   times[0].tv_sec = Buf.st_atime;
 
77
   times[1].tv_sec = Buf.st_mtime;
 
78
   times[0].tv_nsec = times[1].tv_nsec = 0;
 
79
   if (futimens(To.Fd(), times) != 0)
 
80
   {
 
81
      To.OpFail();
 
82
      return _error->Errno("futimens",_("Failed to set modification time"));
 
83
   }
74
84
   To.Close();
75
 
   
76
 
   // Transfer the modification times
77
 
   struct utimbuf TimeBuf;
78
 
   TimeBuf.actime = Buf.st_atime;
79
 
   TimeBuf.modtime = Buf.st_mtime;
80
 
   if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0)
81
 
   {
82
 
      To.OpFail();
83
 
      return _error->Errno("utime",_("Failed to set modification time"));
84
 
   }
85
 
   
 
85
 
86
86
   Hashes Hash;
87
87
   FileFd Fd(Res.Filename, FileFd::ReadOnly);
88
88
   Hash.AddFD(Fd);