X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c55fb5e1d639d72a16604c6e0153e19d04ef0d78..c493b6b81d814db3cdd91f3bb98f5a84456756ff:/generator.c diff --git a/generator.c b/generator.c index df2434f5..8038feb2 100644 --- a/generator.c +++ b/generator.c @@ -91,7 +91,6 @@ extern int max_delete; extern int force_delete; extern int one_file_system; extern int skipped_deletes; -extern struct stats stats; extern dev_t filesystem_dev; extern mode_t orig_umask; extern uid_t our_uid; @@ -392,7 +391,7 @@ static void do_delete_pass(void) int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) { -#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES +#ifndef CAN_SET_SYMLINK_TIMES if (S_ISLNK(file->mode)) { ; } else @@ -417,7 +416,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) if (preserve_acls && !S_ISLNK(file->mode)) { if (!ACL_READY(*sxp)) get_acl(fname, sxp); - if (set_acl(NULL, file, sxp) == 0) + if (set_acl(NULL, file, sxp, file->mode)) return 0; } #endif @@ -440,7 +439,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre if (statret >= 0) { /* A from-dest-dir statret can == 1! */ int keep_time = !preserve_times ? 0 : S_ISDIR(file->mode) ? preserve_times > 1 : -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES 1; #else !S_ISLNK(file->mode); @@ -476,7 +475,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre if (preserve_acls && !S_ISLNK(file->mode)) { if (!ACL_READY(*sxp)) get_acl(fnamecmp, sxp); - if (set_acl(NULL, file, sxp) == 0) + if (set_acl(NULL, file, sxp, file->mode)) iflags |= ITEM_REPORT_ACL; } #endif @@ -516,7 +515,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre #endif } else if (ndx >= 0) { enum logcode code = logfile_format_has_i ? FINFO : FCLIENT; - log_item(code, file, &stats, iflags, xname); + log_item(code, file, iflags, xname); } } } @@ -874,12 +873,15 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, char *cmpbuf, stat_x *sxp, int itemizing, enum logcode code) { - char lnk[MAXPATHLEN]; int best_match = -1; int match_level = 0; enum nonregtype type; uint32 *devp; - int len, j = 0; +#ifdef SUPPORT_LINKS + char lnk[MAXPATHLEN]; + int len; +#endif + int j = 0; #ifndef SUPPORT_LINKS if (S_ISLNK(file->mode)) @@ -919,11 +921,13 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, if (!IS_DEVICE(sxp->st.st_mode)) continue; break; -#ifdef SUPPORT_LINKS case TYPE_SYMLINK: +#ifdef SUPPORT_LINKS if (!S_ISLNK(sxp->st.st_mode)) continue; break; +#else + return -1; #endif } if (match_level < 1) { @@ -939,14 +943,16 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, if (sxp->st.st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp))) continue; break; -#ifdef SUPPORT_LINKS case TYPE_SYMLINK: - if ((len = readlink(cmpbuf, lnk, MAXPATHLEN-1)) <= 0) +#ifdef SUPPORT_LINKS + if ((len = do_readlink(cmpbuf, lnk, MAXPATHLEN-1)) <= 0) continue; lnk[len] = '\0'; if (strcmp(lnk, F_SYMLINK(file)) != 0) continue; break; +#else + return -1; #endif } if (match_level < 2) { @@ -1362,7 +1368,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, int len; if (S_ISLNK(sx.st.st_mode) - && (len = readlink(fname, lnk, MAXPATHLEN-1)) > 0 + && (len = do_readlink(fname, lnk, MAXPATHLEN-1)) > 0 && strncmp(lnk, sl, len) == 0 && sl[len] == '\0') { /* The link is pointing to the right place. */ set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT); @@ -1916,7 +1922,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx) STRUCT_STAT st; if (link_stat(fname, &st, 0) == 0 && cmp_time(st.st_mtime, file->modtime) != 0) - set_modtime(fname, file->modtime, file->mode); + set_modtime(fname, file->modtime, F_MOD_NSEC(file), file->mode); } if (counter >= loopchk_limit) { if (allowed_lull)