X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0fddbd8a09b69f8f96dba770b9e313c5fc2fa895..658a63694bb0ff47ad5a63fb3d98e51954b57b1f:/generator.c diff --git a/generator.c b/generator.c index a98ba9a0..0721790d 100644 --- a/generator.c +++ b/generator.c @@ -248,7 +248,7 @@ static enum delret delete_dir_contents(char *fname, int flags) continue; } - strlcpy(p, F_BASENAME(fp), remainder); + strlcpy(p, fp->basename, remainder); /* Save stack by recursing to ourself directly. */ if (S_ISDIR(fp->mode) && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS) @@ -430,7 +430,7 @@ static void delete_in_dir(struct file_list *flist, char *fbuf, if (allowed_lull) maybe_send_keepalive(); - if (file->dir.depth >= MAXPATHLEN/2+1) + if (F_DEPTH(file) >= MAXPATHLEN/2+1) return; /* Impossible... */ if (io_error && !(lp_ignore_errors(module_id) || ignore_errors)) { @@ -442,9 +442,9 @@ static void delete_in_dir(struct file_list *flist, char *fbuf, return; } - while (cur_depth >= file->dir.depth && cur_depth >= min_depth) + while (cur_depth >= F_DEPTH(file) && cur_depth >= min_depth) pop_local_filters(filt_array[cur_depth--]); - cur_depth = file->dir.depth; + cur_depth = F_DEPTH(file); if (min_depth > cur_depth) min_depth = cur_depth; dlen = strlen(fbuf); @@ -520,8 +520,7 @@ static void do_delete_pass(struct file_list *flist) int unchanged_attrs(struct file_struct *file, STRUCT_STAT *st) { - if (preserve_perms - && (unsigned)(st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) + if (preserve_perms && !BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS)) return 0; if (am_root && preserve_uid && st->st_uid != F_UID(file)) @@ -548,7 +547,7 @@ void itemize(struct file_struct *file, int ndx, int statret, STRUCT_STAT *st, && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname)) || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0)) iflags |= ITEM_REPORT_TIME; - if ((unsigned)(st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) + if (!BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS)) iflags |= ITEM_REPORT_PERMS; if (preserve_uid && am_root && F_UID(file) != st->st_uid) iflags |= ITEM_REPORT_OWNER; @@ -737,7 +736,7 @@ static void generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy) static int find_fuzzy(struct file_struct *file, struct file_list *dirlist) { int fname_len, fname_suf_len; - const char *fname_suf, *fname = F_BASENAME(file); + const char *fname_suf, *fname = file->basename; uint32 lowest_dist = 25 << 16; /* ignore a distance greater than 25 */ int j, lowest_j = -1; @@ -753,7 +752,7 @@ static int find_fuzzy(struct file_struct *file, struct file_list *dirlist) if (!S_ISREG(fp->mode) || !F_LENGTH(fp) || fp->flags & FLAG_SENT) continue; - name = F_BASENAME(fp); + name = fp->basename; if (F_LENGTH(fp) == F_LENGTH(file) && cmp_time(fp->modtime, file->modtime) == 0) { @@ -1099,14 +1098,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (server_filter_list.head) { if (excluded_below >= 0) { - if (file->dir.depth > excluded_below) + if (F_DEPTH(file) > excluded_below) goto skipping; excluded_below = -1; } if (check_filter(&server_filter_list, fname, S_ISDIR(file->mode)) < 0) { if (S_ISDIR(file->mode)) - excluded_below = file->dir.depth; + excluded_below = F_DEPTH(file); skipping: if (verbose) { rprintf(FINFO, @@ -1118,7 +1117,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } if (missing_below >= 0) { - if (file->dir.depth <= missing_below) { + if (F_DEPTH(file) <= missing_below) { if (dry_run) dry_run--; missing_below = -1; @@ -1187,7 +1186,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = -1; } if (dry_run && statret != 0 && missing_below < 0) { - missing_below = file->dir.depth; + missing_below = F_DEPTH(file); dry_run++; } real_ret = statret; @@ -1219,10 +1218,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, full_fname(fname)); file->flags |= FLAG_MISSING_DIR; if (ndx+1 < the_file_list->count - && the_file_list->files[ndx+1]->dir.depth > file->dir.depth) { + && F_DEPTH(the_file_list->files[ndx+1]) > F_DEPTH(file)) { rprintf(FERROR, "*** Skipping everything below this failed directory ***\n"); - missing_below = file->dir.depth; + missing_below = F_DEPTH(file); } return; } @@ -1239,7 +1238,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_FIRST(file) + if (preserve_hard_links && F_HLINK_NOT_FIRST(file) && hard_link_check(file, ndx, fname, statret, &st, itemizing, code)) return; #endif @@ -1298,7 +1297,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = 1; } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (do_symlink(sl, fname) != 0) { @@ -1342,7 +1341,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, t = "special file"; } if (statret == 0 - && (unsigned)(st.st_mode & ~CHMOD_BITS) == (file->mode & ~CHMOD_BITS) + && BITS_EQUAL(st.st_mode, file->mode, _S_IFMT) && st.st_rdev == rdev) { /* The device or special file is identical. */ if (itemizing) @@ -1375,7 +1374,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = 1; } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (verbose > 2) { @@ -1495,7 +1494,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (statret != 0) { #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif if (stat_errno == ENOENT) @@ -1558,7 +1557,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, pretend_missing: /* pretend the file didn't exist */ #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_NOT_HLINK_LAST(file)) + if (preserve_hard_links && F_HLINK_NOT_LAST(file)) return; #endif statret = real_ret = -1; @@ -1617,7 +1616,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (fnamecmp_type == FNAMECMP_FUZZY) iflags |= ITEM_XNAME_FOLLOWS; itemize(file, -1, real_ret, &real_st, iflags, fnamecmp_type, - fuzzy_file ? F_BASENAME(fuzzy_file) : NULL); + fuzzy_file ? fuzzy_file->basename : NULL); } if (!do_xfers) { @@ -1826,10 +1825,10 @@ void generate_files(int f_out, struct file_list *flist, char *local_name) if (!need_retouch_dir_times && file->mode & S_IWUSR) continue; if (file->flags & FLAG_MISSING_DIR) { - int missing = file->dir.depth; + int missing = F_DEPTH(file); while (++i < flist->count) { file = flist->files[i]; - if (file->dir.depth <= missing) + if (F_DEPTH(file) <= missing) break; } i--;