=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/uploader.c,v retrieving revision 1.33 retrieving revision 1.34 diff -c -r1.33 -r1.34 *** src/usr.bin/rsync/uploader.c 2021/11/03 14:42:12 1.33 --- src/usr.bin/rsync/uploader.c 2023/04/28 10:24:39 1.34 *************** *** 1,4 **** ! /* $OpenBSD: uploader.c,v 1.33 2021/11/03 14:42:12 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * Copyright (c) 2019 Florian Obser --- 1,4 ---- ! /* $OpenBSD: uploader.c,v 1.34 2023/04/28 10:24:39 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * Copyright (c) 2019 Florian Obser *************** *** 652,658 **** * The stat pointer st is only valid for 0, 1, and 2 returns. */ static int ! check_file(int rootfd, const struct flist *f, struct stat *st) { if (fstatat(rootfd, f->path, st, AT_SYMLINK_NOFOLLOW) == -1) { if (errno == ENOENT) --- 652,659 ---- * The stat pointer st is only valid for 0, 1, and 2 returns. */ static int ! check_file(int rootfd, const struct flist *f, struct stat *st, ! struct sess *sess) { if (fstatat(rootfd, f->path, st, AT_SYMLINK_NOFOLLOW) == -1) { if (errno == ENOENT) *************** *** 666,674 **** if (!S_ISREG(st->st_mode)) return 2; /* quick check if file is the same */ - /* TODO: add support for --checksum, --size-only and --ignore-times */ if (st->st_size == f->st.size) { if (st->st_mtime == f->st.mtime) return 0; return 1; --- 667,682 ---- if (!S_ISREG(st->st_mode)) return 2; + /* TODO: add support for --checksum */ + + /* if ignore_times is on file needs attention */ + if (sess->opts->ignore_times) + return 2; + /* quick check if file is the same */ if (st->st_size == f->st.size) { + if (sess->opts->size_only) + return 0; if (st->st_mtime == f->st.mtime) return 0; return 1; *************** *** 721,727 **** *size = 0; *filefd = -1; ! rc = check_file(p->rootfd, f, &st); if (rc == -1) return -1; if (rc == 2 && !S_ISREG(st.st_mode)) { --- 729,735 ---- *size = 0; *filefd = -1; ! rc = check_file(p->rootfd, f, &st, sess); if (rc == -1) return -1; if (rc == 2 && !S_ISREG(st.st_mode)) { *************** *** 748,754 **** dfd = openat(p->rootfd, root, O_RDONLY | O_DIRECTORY); if (dfd == -1) err(ERR_FILE_IO, "%s: openat", root); ! x = check_file(dfd, f, &st); /* found a match */ if (x == 0) { if (rc >= 0) { --- 756,762 ---- dfd = openat(p->rootfd, root, O_RDONLY | O_DIRECTORY); if (dfd == -1) err(ERR_FILE_IO, "%s: openat", root); ! x = check_file(dfd, f, &st, sess); /* found a match */ if (x == 0) { if (rc >= 0) {