diff options
author | David Dykstra <dwd@samba.org> | 1998-11-24 19:01:24 +0000 |
---|---|---|
committer | David Dykstra <dwd@samba.org> | 1998-11-24 19:01:24 +0000 |
commit | 53dd3135f13728fbcfce4c85773d9fc97cfce714 (patch) | |
tree | c1ccdbedbd39f0c271154bab15064e6be7792bc8 /receiver.c | |
parent | cd64343a7aaa1211ee330eaf9e78a33cf247637f (diff) | |
download | rsync-53dd3135f13728fbcfce4c85773d9fc97cfce714.tar.gz |
Backup deleted files when using --delete and --backup. Based on a
suggested patch from Kanai Makoto (kanai@hallab.co.jp).
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -33,6 +33,8 @@ extern int cvs_exclude; extern int io_error; extern char *tmpdir; extern char *compare_dest; +extern int make_backups; +extern char *backup_suffix; static struct delete_list { @@ -139,8 +141,15 @@ static void delete_files(struct file_list *flist) S_ISDIR(local_file_list->files[i]->mode)) add_delete_entry(local_file_list->files[i]); if (-1 == flist_find(flist,local_file_list->files[i])) { - delete_one(local_file_list->files[i]); - } + char *f = f_name(local_file_list->files[i]); + int k = strlen(f) - strlen(backup_suffix); + if (make_backups && ((k <= 0) || + (strcmp(f+k,backup_suffix) != 0))) { + (void) make_backup(f); + } else { + delete_one(local_file_list->files[i]); + } + } } flist_free(local_file_list); free(name); |