Move var declaration for older C compilers.
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 60e0063..0758f89 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -69,6 +69,7 @@ extern int sender_symlink_iconv;
 extern int output_needs_newline;
 extern int sender_keeps_checksum;
 extern int unsort_ndx;
+extern uid_t our_uid;
 extern struct stats stats;
 extern char *filesfrom_host;
 extern char *usermap, *groupmap;
@@ -1371,10 +1372,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        }
 #endif
        file->mode = st.st_mode;
-       if (uid_ndx) /* Check uid_ndx instead of preserve_uid for del support */
+       if (preserve_uid)
                F_OWNER(file) = st.st_uid;
-       if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */
+       if (preserve_gid)
                F_GROUP(file) = st.st_gid;
+       if (am_generator && st.st_uid == our_uid)
+               file->flags |= FLAG_OWNED_BY_US;
 
        if (basename != thisname)
                file->dirname = lastdir;
@@ -1731,11 +1734,12 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
                remainder = 0;
 
        for (errno = 0, di = readdir(d); di; errno = 0, di = readdir(d)) {
+               unsigned name_len;
                char *dname = d_name(di);
                if (dname[0] == '.' && (dname[1] == '\0'
                    || (dname[1] == '.' && dname[2] == '\0')))
                        continue;
-               unsigned name_len = strlcpy(p, dname, remainder);
+               name_len = strlcpy(p, dname, remainder);
                if (name_len >= remainder) {
                        char save = fbuf[len];
                        fbuf[len] = '\0';