*** work/rsync-3.0.7/generator.c.orig 2009-12-23 21:36:27.000000000 +0200 --- work/rsync-3.0.7/generator.c 2010-07-09 15:36:01.000000000 +0300 *************** *** 96,101 **** --- 96,102 ---- extern char *backup_dir; extern char *backup_suffix; extern int backup_suffix_len; + extern long check_point; extern struct file_list *cur_flist, *first_flist, *dir_flist; extern struct filter_list_struct daemon_filter_list; *************** *** 132,138 **** }; enum delret { ! DR_SUCCESS = 0, DR_FAILURE, DR_AT_LIMIT, DR_NOT_EMPTY }; /* Forward declarations. */ --- 133,139 ---- }; enum delret { ! DR_SUCCESS = 0, DR_FAILURE, DR_AT_LIMIT, DR_NOT_EMPTY, DR_NEWER }; /* Forward declarations. */ *************** *** 160,165 **** --- 161,192 ---- char *what; int ok; + struct stat attrib; + stat(fbuf, &attrib); + if ( (check_point>=0)&&(check_point <= attrib.st_mtime) ) { + //if (!S_ISDIR(mode)) { + if (verbose > 0) { + rprintf(FINFO, "checkpoint: new item (%s), deletion skiped", fbuf); + rprintf(FINFO, verbose > 1 ? " (%d <= %d)\n" : "\n", check_point, attrib.st_mtime ); + } + return DR_NEWER; + //} + /* + DIR *d = opendir(fbuf); + struct dirent *p; + int is_empty = 1; + while ((is_empty>0)&&(p=readdir(d))) { + if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) continue; + is_empty = 0; + } + closedir(d); + if ((is_empty>0)&&(verbose > 0)) { + rprintf(FINFO, "empty dir (%s) is newer", fbuf); + rprintf(FINFO, verbose > 1 ? " (%d <= %d)\n" : "\n", check_point, attrib.st_mtime ); + } + */ + } + if (verbose > 2) { rprintf(FINFO, "delete_item(%s) mode=%o flags=%d\n", fbuf, (int)mode, (int)flags); *************** *** 1369,1374 **** --- 1396,1409 ---- stat_errno = errno; } + if ( (check_point>=0)&&(statret != 0)&&(check_point > file->modtime) ) { + if (verbose > 0) { + rprintf(FINFO, is_dir ? "checkpoint: old directory (%s)" : "checkpoint: old item (%s), creation skipped", fname); + rprintf(FINFO, verbose > 1 ? " (%d > %d)\n" : "\n", check_point, file->modtime); + } + if ( !is_dir ) return; + } + if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) { if (is_dir) { if (is_dir < 0)