diff options
Diffstat (limited to 'lib/backupclient')
-rw-r--r-- | lib/backupclient/BackupClientFileAttributes.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/backupclient/BackupClientFileAttributes.cpp b/lib/backupclient/BackupClientFileAttributes.cpp index 49bae665..ba65d57a 100644 --- a/lib/backupclient/BackupClientFileAttributes.cpp +++ b/lib/backupclient/BackupClientFileAttributes.cpp @@ -642,11 +642,7 @@ void BackupClientFileAttributes::WriteAttributes(const char *Filename) const } // If working as root, set user IDs - #ifdef WIN32 - if(0) - #else if(::geteuid() == 0) - #endif { #ifndef HAVE_LCHOWN // only if not a link, can't set their owner on this platform @@ -683,10 +679,24 @@ void BackupClientFileAttributes::WriteAttributes(const char *Filename) const { // Work out times as timevals struct timeval times[2]; + + #ifdef WIN32 + BoxTimeToTimeval(box_ntoh64(pattr->ModificationTime), + times[1]); + BoxTimeToTimeval(box_ntoh64(pattr->AttrModificationTime), + times[0]); + // Because stat() returns the creation time in the ctime + // field under Windows, and this gets saved in the + // AttrModificationTime field of the serialised attributes, + // we subvert the first parameter of emu_utimes() to allow + // it to be reset to the right value on the restored file. + #else BoxTimeToTimeval(modtime, times[1]); // Copy access time as well, why not, got to set it to something times[0] = times[1]; - // Attr modification time will be changed anyway, nothing that can be done about it + // Attr modification time will be changed anyway, + // nothing that can be done about it + #endif // Try to apply if(::utimes(Filename, times) != 0) |