diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:12:24 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:12:24 +0000 |
commit | f95f7bc1616c954043e3e5b06e2dac1f0530b5ad (patch) | |
tree | d1b6f70bfd2b83a22764749a9fe4340def62a663 | |
parent | f9bedd322c6f1050a9743d98c747d65f953207b7 (diff) |
Remove #ifdefs around geteuid(), re-enable use of fake version under Win32
as requested by Ben.
Restore serialised AttrModificationTime under Win32 by passing to
emu_utimes(). (refs #3)
-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) |