Acts on the indicated item in cur_flist whose name is fname. If a dir, * make sure it exists, and has the right permissions/timestamp info. For * all other non-regular files (symlinks, etc.) we create them here. For * regular files that have changed, we try to find a basis file and then * start sending checksums. The ndx is the file's unique index value. * * The fname parameter must poin
| 1217 | * Note that f_out is set to -1 when doing final directory-permission and |
| 1218 | * modification-time repair. */ |
| 1219 | static void recv_generator(char *fname, struct file_struct *file, int ndx, |
| 1220 | int itemizing, enum logcode code, int f_out) |
| 1221 | { |
| 1222 | static const char *parent_dirname = ""; |
| 1223 | static struct file_struct *prior_dir_file = NULL; |
| 1224 | /* Missing dir not created due to --dry-run; will still be scanned. */ |
| 1225 | static struct file_struct *dry_missing_dir = NULL; |
| 1226 | /* Missing dir whose contents are skipped altogether due to |
| 1227 | * --ignore-non-existing, daemon exclude, or mkdir failure. */ |
| 1228 | static struct file_struct *skip_dir = NULL; |
| 1229 | static struct file_list *fuzzy_dirlist[MAX_BASIS_DIRS+1]; |
| 1230 | static int need_fuzzy_dirlist = 0; |
| 1231 | struct file_struct *fuzzy_file = NULL; |
| 1232 | int fd = -1, f_copy = -1; |
| 1233 | stat_x sx, real_sx; |
| 1234 | STRUCT_STAT partial_st; |
| 1235 | struct file_struct *back_file = NULL; |
| 1236 | int statret, real_ret, stat_errno; |
| 1237 | char *fnamecmp, *partialptr, *backupptr = NULL; |
| 1238 | char fnamecmpbuf[MAXPATHLEN]; |
| 1239 | uchar fnamecmp_type; |
| 1240 | int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0; |
| 1241 | enum filetype stype, ftype = get_file_type(file->mode); |
| 1242 | int is_dir = ftype != FT_DIR ? 0 |
| 1243 | : inc_recurse && ndx != cur_flist->ndx_start - 1 ? -1 |
| 1244 | : 1; |
| 1245 | |
| 1246 | if (DEBUG_GTE(GENR, 1)) |
| 1247 | rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx); |
| 1248 | |
| 1249 | if (list_only) { |
| 1250 | if (is_dir < 0 |
| 1251 | || (is_dir && !implied_dirs && file->flags & FLAG_IMPLIED_DIR)) |
| 1252 | return; |
| 1253 | list_file_entry(file); |
| 1254 | return; |
| 1255 | } |
| 1256 | |
| 1257 | maybe_ATTRS_ACCURATE_TIME = always_checksum ? ATTRS_ACCURATE_TIME : 0; |
| 1258 | |
| 1259 | if (skip_dir) { |
| 1260 | if (is_below(file, skip_dir)) { |
| 1261 | if (is_dir) |
| 1262 | file->flags |= FLAG_MISSING_DIR; |
| 1263 | #ifdef SUPPORT_HARD_LINKS |
| 1264 | else if (F_IS_HLINKED(file)) |
| 1265 | handle_skipped_hlink(file, itemizing, code, f_out); |
| 1266 | #endif |
| 1267 | return; |
| 1268 | } |
| 1269 | skip_dir = NULL; |
| 1270 | } |
| 1271 | |
| 1272 | init_stat_x(&sx); |
| 1273 | if (daemon_filter_list.head && (*fname != '.' || fname[1])) { |
| 1274 | if (check_filter(&daemon_filter_list, FLOG, fname, is_dir) < 0) { |
| 1275 | if (is_dir < 0) |
| 1276 | return; |
no test coverage detected