diff options
author | Wayne Davison <wayned@samba.org> | 2004-09-07 21:34:26 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2004-09-07 21:34:26 +0000 |
commit | dc55d7bdabb5a5d5c8cc97794171b485e4f75f19 (patch) | |
tree | e0ed2253f9d0f5a817313c7128a2cf1fa3d9db8a /receiver.c | |
parent | 8b115ac8dc8ddf15a54096f01ae17848033801d1 (diff) | |
download | rsync-dc55d7bdabb5a5d5c8cc97794171b485e4f75f19.tar.gz |
If we're making backups with --inplace, use the backup file as the
basis file while still updating the real destination file inplace.
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -438,6 +438,11 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) } else fnamecmp = partialptr = fname; + if (inplace && make_backups) { + if (!(fnamecmp = get_backup_name(fname))) + fnamecmp = partialptr; + } + /* open the file */ fd1 = do_open(fnamecmp, O_RDONLY, 0); @@ -489,10 +494,10 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) /* We now check to see if we are writing file "inplace" */ if (inplace) { - fd2 = do_open(fnamecmp, O_WRONLY|O_CREAT, 0); + fd2 = do_open(fname, O_WRONLY|O_CREAT, 0); if (fd2 == -1) { rsyserr(FERROR, errno, "open %s failed", - full_fname(fnamecmp)); + full_fname(fname)); discard_receive_data(f_in, file->length); if (fd1 != -1) close(fd1); |