mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-10 06:03:38 +00:00
FreeBSD: acl_get: add an acl_extended_* call
... to implement same semantics as on linux (only store ACL if it defines permissions other than those defined by the traditional file permissions). Looks like there is no call working with an fd on FreeBSD.
This commit is contained in:
parent
6ad1ad67d5
commit
9d638e8d62
1 changed files with 7 additions and 0 deletions
|
@ -42,6 +42,7 @@ cdef extern from "sys/acl.h":
|
|||
char *acl_to_text_np(acl_t acl, ssize_t *len, int flags)
|
||||
int ACL_TEXT_NUMERIC_IDS
|
||||
int ACL_TEXT_APPEND_ID
|
||||
int acl_extended_link_np(const char * path) # check also: acl_is_trivial_np
|
||||
|
||||
cdef extern from "unistd.h":
|
||||
long lpathconf(const char *path, int name)
|
||||
|
@ -146,6 +147,12 @@ def acl_get(path, item, st, numeric_ids=False, fd=None):
|
|||
cdef int flags = ACL_TEXT_APPEND_ID
|
||||
if isinstance(path, str):
|
||||
path = os.fsencode(path)
|
||||
ret = acl_extended_link_np(path)
|
||||
if ret < 0:
|
||||
raise OSError(errno.errno, os.strerror(errno.errno), os.fsdecode(path))
|
||||
if ret == 0:
|
||||
# there is no ACL defining permissions other than those defined by the traditional file permission bits.
|
||||
return
|
||||
ret = lpathconf(path, _PC_ACL_NFS4)
|
||||
if ret < 0 and errno.errno == errno.EINVAL:
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue