summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-04-11 11:31:31 -0700
committerWayne Davison <wayned@samba.org>2009-04-11 11:51:07 -0700
commit3696674bc62b0c1250027dbeedafdd7ebafdcf8b (patch)
treeead58ed7615e0ed0a8cdb32678ce3d5ec96b9e98 /main.c
parent5e2d51ee0675dc39d89c9ec11297a33c12b9181d (diff)
downloadrsync-3696674bc62b0c1250027dbeedafdd7ebafdcf8b.tar.gz
rsync-3696674bc62b0c1250027dbeedafdd7ebafdcf8b.tar.bz2
rsync-3696674bc62b0c1250027dbeedafdd7ebafdcf8b.zip
More backup improvements:
- Changed get_backup_name() to verify the backup path, and make any missing directories. This avoids accidental use of a symlink as a dir in a backup path, and gets rid of any other non-dirs that are in the way. It also avoids the need for various operations to retry after calling make_bak_dir(), simplifying several pices of code. - Changed create_directory_path() to make_path(), giving it flags that lets the caller decide if it should skip a leading slash or drop the trailing filename. - Mention when we create the backup directory, so the user is not caught unaware when rsync uses a directory they didn't expect. - Got rid of some dir-moving backup code that is not used. - Added a little more backup-debug output.
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c
index 2ef2f479..75e9a2fe 100644
--- a/main.c
+++ b/main.c
@@ -77,7 +77,9 @@ extern char *rsync_path;
extern char *shell_cmd;
extern char *batch_name;
extern char *password_file;
+extern char *backup_dir;
extern char curr_dir[MAXPATHLEN];
+extern char backup_dir_buf[MAXPATHLEN];
extern char *basis_dir[MAX_BASIS_DIRS+1];
extern struct file_list *first_flist;
extern struct filter_list_struct daemon_filter_list;
@@ -817,6 +819,18 @@ static int do_recv(int f_in, int f_out, char *local_name)
exit_cleanup(RERR_IPC);
}
+ if (backup_dir) {
+ int ret = make_path(backup_dir_buf, MKP_DROP_NAME); /* drops trailing slash */
+ if (ret < 0)
+ exit_cleanup(RERR_SYNTAX);
+ if (ret)
+ rprintf(FINFO, "Created backup_dir %s\n", backup_dir_buf);
+ else if (INFO_GTE(BACKUP, 1)) {
+ char *dir = *backup_dir_buf ? backup_dir_buf : ".";
+ rprintf(FINFO, "backup_dir is %s\n", dir);
+ }
+ }
+
io_flush(NORMAL_FLUSH);
if ((pid = do_fork()) == -1) {