summaryrefslogtreecommitdiff
path: root/usr.bin/rsync/downloader.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2019-02-12 19:14:00 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2019-02-12 19:14:00 +0000
commit0d19b965e986b61ef40bb18ad2c2a810a987f438 (patch)
tree2daf63e5579d235b0e9f6d49c2df827aa07ba79d /usr.bin/rsync/downloader.c
parent32a3b39f5bf2f4150507889dba1b378cfb65e774 (diff)
sync
commit 8d00f73ef924d2c39c35f0eb2428d465b949bbe0 Author: kristaps <> Date: Tue Feb 12 07:37:24 2019 +0000 Document the process of reassigning gid.
Diffstat (limited to 'usr.bin/rsync/downloader.c')
-rw-r--r--usr.bin/rsync/downloader.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c
index 2d5d4ab7f83..b2bb0dd35e2 100644
--- a/usr.bin/rsync/downloader.c
+++ b/usr.bin/rsync/downloader.c
@@ -1,4 +1,4 @@
-/* $Id: downloader.c,v 1.5 2019/02/12 19:10:28 benno Exp $ */
+/* $Id: downloader.c,v 1.6 2019/02/12 19:13:59 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -568,14 +568,23 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd)
goto out;
}
+ /*
+ * Conditionally adjust group id.
+ * FIXME: remember the original file's group id and don't
+ * reassign it if it's the same.
+ * If we have an EPERM, report it but continue on: this just
+ * means that we're mapping into an unknown (or disallowed)
+ * group identifier.
+ */
+
if (sess->opts->preserve_gids) {
if (fchown(p->fd, -1, f->st.gid) == -1) {
if (errno != EPERM) {
ERR(sess, "%s: fchown", p->fname);
goto out;
}
- WARNX(sess, "%s: gid not available to user: %u",
- f->path, f->st.gid);
+ WARNX(sess, "%s: gid unknown or not available "
+ "to user: %u", f->path, f->st.gid);
} else
LOG4(sess, "%s: updated gid", f->path);
}