--- a/flist.c +++ b/flist.c @@ -1123,8 +1123,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, pool = dir_flist->file_pool; } else pool = flist->file_pool; - } else + } else { +#ifdef SUPPORT_ACLS + /* Directories need an extra int32 for the default ACL. */ + if (preserve_acls && S_ISDIR(st.st_mode)) + extra_len += EXTRA_LEN; +#endif pool = NULL; + } if (verbose > 2) { rprintf(FINFO, "[%s] make_file(%s,*,%d)\n", @@ -1219,7 +1225,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, if (always_checksum && am_sender && S_ISREG(st.st_mode)) file_checksum(thisname, tmp_sum, st.st_size); - F_PATHNAME(file) = pathname; + if (am_sender) + F_PATHNAME(file) = pathname; + else if (!pool) + F_DEPTH(file) = extra_len / EXTRA_LEN; /* This code is only used by the receiver when it is building * a list of files for a delete pass. */ @@ -1255,12 +1264,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, /* Only called for temporary file_struct entries created by make_file(). */ void unmake_file(struct file_struct *file) { - int extra_cnt = file_extra_cnt + LEN64_BUMP(file); -#if EXTRA_ROUNDING > 0 - if (extra_cnt & EXTRA_ROUNDING) - extra_cnt = (extra_cnt | EXTRA_ROUNDING) + 1; -#endif - free(REQ_EXTRA(file, extra_cnt)); + free(REQ_EXTRA(file, F_DEPTH(file))); } static struct file_struct *send_file_name(int f, struct file_list *flist,