diff options
-rw-r--r-- | usr.bin/rsync/downloader.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c index d243897fb39..2d5d4ab7f83 100644 --- a/usr.bin/rsync/downloader.c +++ b/usr.bin/rsync/downloader.c @@ -1,4 +1,4 @@ -/* $Id: downloader.c,v 1.4 2019/02/11 21:41:22 deraadt Exp $ */ +/* $Id: downloader.c,v 1.5 2019/02/12 19:10:28 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -568,6 +568,18 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) goto out; } + 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); + } else + LOG4(sess, "%s: updated gid", f->path); + } + /* Conditionally adjust file modification time. */ if (sess->opts->preserve_times) { |