When calling lchown, pass the current known uid and gid rather than -1
authorDavid Dykstra <dwd@samba.org>
Wed, 3 Feb 1999 15:15:56 +0000 (15:15 +0000)
committerDavid Dykstra <dwd@samba.org>
Wed, 3 Feb 1999 15:15:56 +0000 (15:15 +0000)
to not change it, since the old SVR2-based UTS 2.1.2 does not support
leaving uid and gid alone when the value is -1.

rsync.c

diff --git a/rsync.c b/rsync.c
index 1988b37..3f79f50 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -149,8 +149,8 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
            ((am_root && preserve_uid && st->st_uid != file->uid) || 
             (preserve_gid && st->st_gid != file->gid))) {
                if (do_lchown(fname,
            ((am_root && preserve_uid && st->st_uid != file->uid) || 
             (preserve_gid && st->st_gid != file->gid))) {
                if (do_lchown(fname,
-                             (am_root&&preserve_uid)?file->uid:-1,
-                             preserve_gid?file->gid:-1) != 0) {
+                             (am_root&&preserve_uid)?file->uid:st->st_uid,
+                             preserve_gid?file->gid:st->st_gid) != 0) {
                        if (preserve_uid && st->st_uid != file->uid)
                                updated = 1;
                        if (verbose>1 || preserve_uid) {
                        if (preserve_uid && st->st_uid != file->uid)
                                updated = 1;
                        if (verbose>1 || preserve_uid) {