copy: add copy_access() helper for copying access mode
This commit is contained in:
parent
5c05f06264
commit
bacf21e9e9
|
@ -969,6 +969,21 @@ int copy_times(int fdf, int fdt, CopyFlags flags) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int copy_access(int fdf, int fdt) {
|
||||
struct stat st;
|
||||
|
||||
assert(fdf >= 0);
|
||||
assert(fdt >= 0);
|
||||
|
||||
if (fstat(fdf, &st) < 0)
|
||||
return -errno;
|
||||
|
||||
if (fchmod(fdt, st.st_mode & 07777) < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int copy_xattr(int fdf, int fdt) {
|
||||
_cleanup_free_ char *names = NULL;
|
||||
int ret = 0, r;
|
||||
|
|
|
@ -61,4 +61,5 @@ static inline int copy_bytes(int fdf, int fdt, uint64_t max_bytes, CopyFlags cop
|
|||
}
|
||||
|
||||
int copy_times(int fdf, int fdt, CopyFlags flags);
|
||||
int copy_access(int fdf, int fdt);
|
||||
int copy_xattr(int fdf, int fdt);
|
||||
|
|
Loading…
Reference in New Issue