if rsync fails to update the group of a file but nothing else then
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 Mar 1998 00:32:51 +0000 (00:32 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 26 Mar 1998 00:32:51 +0000 (00:32 +0000)
don't report a problem. On most OSes non-root users can't change the
group of a file.

rsync.c

diff --git a/rsync.c b/rsync.c
index 2ef416db646192929117fa1b5d3e7b6155a97b52..3b4ff1ba57fefa3956eaa4d97105d66927803faa 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -302,21 +302,24 @@ static int set_perms(char *fname,struct file_struct *file,struct stat *st,
 
   if ((am_root && preserve_uid && st->st_uid != file->uid) || 
       (preserve_gid && st->st_gid != file->gid)) {
-    updated = 1;
-    if (do_lchown(fname,
-              (am_root&&preserve_uid)?file->uid:-1,
-              preserve_gid?file->gid:-1) != 0) {
-      if (verbose>1 || preserve_uid)
-       fprintf(FERROR,"chown %s : %s\n",fname,strerror(errno));
-      return updated;
-    }
+         if (do_lchown(fname,
+                       (am_root&&preserve_uid)?file->uid:-1,
+                       preserve_gid?file->gid:-1) != 0) {
+                 if (preserve_uid && st->st_uid != file->uid)
+                         updated = 1;
+                 if (verbose>1 || preserve_uid)
+                         fprintf(FERROR,"chown %s : %s\n",
+                                 fname,strerror(errno));
+                 return updated;
+         }
+         updated = 1;
   }
     
   if (verbose > 1 && report) {
-    if (updated)
-      fprintf(FINFO,"%s\n",fname);
-    else
-      fprintf(FINFO,"%s is uptodate\n",fname);
+         if (updated)
+                 fprintf(FINFO,"%s\n",fname);
+         else
+                 fprintf(FINFO,"%s is uptodate\n",fname);
   }
   return updated;
 }