+static void touch_up_dirs(struct file_list *flist, int ndx,
+ int need_retouch_dir_times, int lull_mod)
+{
+ struct file_struct *file;
+ char *fname;
+ int i, j, start, end;
+
+ if (ndx < 0) {
+ start = 0;
+ end = flist->count - 1;
+ } else
+ start = end = ndx;
+
+ /* Fix any directory permissions that were modified during the
+ * transfer and/or re-set any tweaked modified-time values. */
+ for (i = start, j = 0; i <= end; i++) {
+ file = flist->files[i];
+ if (!F_IS_ACTIVE(file) || !S_ISDIR(file->mode)
+ || file->flags & FLAG_MISSING_DIR)
+ continue;
+ if (!need_retouch_dir_times && file->mode & S_IWUSR)
+ continue;
+ fname = f_name(file, NULL);
+ if (!(file->mode & S_IWUSR))
+ do_chmod(fname, file->mode);
+ if (need_retouch_dir_times)
+ set_modtime(fname, file->modtime, file->mode);
+ if (allowed_lull && !(++j % lull_mod))
+ maybe_send_keepalive();
+ else if (!(j % 200))
+ maybe_flush_socket();
+ }
+}
+
+void generate_files(int f_out, char *local_name)