diff options
author | Colin Walters <walters@verbum.org> | 2021-02-09 22:30:19 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2021-02-09 22:30:19 +0000 |
commit | 4c9055ac08bb64dca146724f488cce4c1ce4c628 (patch) | |
tree | 3f091df1acc37cbed8cf335e45fbb5b7d5bb80cf | |
parent | 900caea698690b18db4f2a9cd2c3abb4f84f10b5 (diff) | |
parent | 1345882d6a5fc3ea851bfe5510e79861d511c25e (diff) | |
download | libglnx-4c9055ac08bb64dca146724f488cce4c1ce4c628.tar.gz |
Merge branch 'pr/glnx-no-chown' into 'master'
glnx_file_copy_at: Add GLNX_FILE_COPY_NOCHOWN
See merge request GNOME/libglnx!22
-rw-r--r-- | glnx-fdio.c | 7 | ||||
-rw-r--r-- | glnx-fdio.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/glnx-fdio.c b/glnx-fdio.c index d4eeb24..3fa73b5 100644 --- a/glnx-fdio.c +++ b/glnx-fdio.c @@ -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)) { diff --git a/glnx-fdio.h b/glnx-fdio.h index 40931bf..3d1f024 100644 --- a/glnx-fdio.h +++ b/glnx-fdio.h @@ -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 |