mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 15:12:00 +00:00
PR #244 - Merge branch 'fix_atime' into merge
This commit is contained in:
commit
f31897bb1f
1 changed files with 3 additions and 1 deletions
|
@ -450,7 +450,8 @@ def open_simple(p, s):
|
|||
return open(p, 'rb')
|
||||
|
||||
def open_noatime_if_owner(p, s):
|
||||
if s.st_uid == euid:
|
||||
if euid == 0 or s.st_uid == euid:
|
||||
# we are root or owner of file
|
||||
return os.fdopen(os.open(p, flags_noatime), 'rb')
|
||||
else:
|
||||
return open(p, 'rb')
|
||||
|
@ -463,6 +464,7 @@ def open_noatime(p, s):
|
|||
fo = open(p, 'rb')
|
||||
# Yes, it was -- otherwise the above line would have thrown
|
||||
# another exception.
|
||||
nonlocal euid
|
||||
euid = os.geteuid()
|
||||
# So in future, let's check whether the file is owned by us
|
||||
# before attempting to use O_NOATIME.
|
||||
|
|
Loading…
Reference in a new issue