Merge branch 'pr/glnx-no-chown' into 'master'

glnx_file_copy_at: Add GLNX_FILE_COPY_NOCHOWN

See merge request GNOME/libglnx!22
This commit is contained in:
Colin Walters
2021-02-09 22:30:19 +00:00
2 changed files with 7 additions and 3 deletions

View File

@@ -1000,8 +1000,11 @@ glnx_file_copy_at (int src_dfd,
if (glnx_regfile_copy_bytes (src_fd, tmp_dest.fd, (off_t) -1) < 0)
return glnx_throw_errno_prefix (error, "regfile copy");
if (fchown (tmp_dest.fd, src_stbuf->st_uid, src_stbuf->st_gid) != 0)
return glnx_throw_errno_prefix (error, "fchown");
if (!(copyflags & GLNX_FILE_COPY_NOCHOWN))
{
if (fchown (tmp_dest.fd, src_stbuf->st_uid, src_stbuf->st_gid) != 0)
return glnx_throw_errno_prefix (error, "fchown");
}
if (!(copyflags & GLNX_FILE_COPY_NOXATTRS))
{

View File

@@ -189,7 +189,8 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes);
typedef enum {
GLNX_FILE_COPY_OVERWRITE = (1 << 0),
GLNX_FILE_COPY_NOXATTRS = (1 << 1),
GLNX_FILE_COPY_DATASYNC = (1 << 2)
GLNX_FILE_COPY_DATASYNC = (1 << 2),
GLNX_FILE_COPY_NOCHOWN = (1 << 3)
} GLnxFileCopyFlags;
gboolean