if rsync fails to update the group of a file but nothing else then
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index 2ef416d..3b4ff1b 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;
 }