diff --git a/secondary.py b/secondary.py index e2128f72a3b91a54060627496d12589c79317e7a..d5a1dd56278a2fbf4c772b0c6f6fead9f29b948e 100644 --- a/secondary.py +++ b/secondary.py @@ -8,6 +8,7 @@ import os import socket import subprocess import time +import shutil def cond_unlink(path, log): try: @@ -88,10 +89,11 @@ class Backup: dst.uid, dst.gid) os.lchown(dst_path, int(src.uid), int(src.gid)) changed = True - if src.kind == b'F' and src.mtime != dst.mtime: + if src.kind in [ b'F', b'L' ] and src.mtime != dst.mtime: self.log.DEBUG('MTIME', src.name, src.mtime, dst.mtime) - atime = os.stat(dst_path).st_atime - os.utime(dst_path, (int(atime), int(src.mtime))) + atime = os.lstat(dst_path).st_atime + os.utime(dst_path, (int(atime), int(src.mtime)), + follow_symlinks=False) changed = True if changed: self.status.metadata += 1