[BACK]Return to receiver.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rsync

Diff for /src/usr.bin/rsync/receiver.c between version 1.7 and 1.8

version 1.7, 2019/02/14 18:29:08 version 1.8, 2019/02/14 18:30:11
Line 44 
Line 44 
 rsync_set_metadata(struct sess *sess, int newfile,  rsync_set_metadata(struct sess *sess, int newfile,
         int fd, const struct flist *f, const char *path)          int fd, const struct flist *f, const char *path)
 {  {
         uid_t            uid;          uid_t            uid = (uid_t)-1;
         gid_t            gid;          gid_t            gid = (gid_t)-1;
         struct timespec  tv[2];          struct timespec  tv[2];
   
         /*          /*
Line 55 
Line 55 
          * group identifier.           * group identifier.
          */           */
   
         if (sess->opts->preserve_gids ||          if (getuid() == 0 && sess->opts->preserve_uids)
             sess->opts->preserve_uids) {                  uid = f->st.uid;
                 uid = sess->opts->preserve_uids ? f->st.uid : -1;          if (sess->opts->preserve_gids)
                 gid = sess->opts->preserve_gids ? f->st.gid : -1;                  gid = f->st.gid;
   
           if (uid != (uid_t)-1 || gid != (gid_t)-1) {
                 if (fchown(fd, uid, gid) == -1) {                  if (fchown(fd, uid, gid) == -1) {
                         if (errno != EPERM) {                          if (errno != EPERM) {
                                 ERR(sess, "%s: fchown", path);                                  ERR(sess, "%s: fchown", path);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8