summaryrefslogtreecommitdiff
path: root/rsync.c
diff options
context:
space:
mode:
authorDavid Dykstra <dwd@samba.org>1999-03-11 22:17:42 +0000
committerDavid Dykstra <dwd@samba.org>1999-03-11 22:17:42 +0000
commitc7c11a0d4c315a052dddf97cc6d3d63a54b4a831 (patch)
tree44df2879171d94040aed046a24cdd19f8d04ae88 /rsync.c
parentc27f25922e9f59e439228a3c3e0c38342899a80f (diff)
downloadrsync-c7c11a0d4c315a052dddf97cc6d3d63a54b4a831.tar.gz
When a file cannot be deleted because of ETXTBSY (in particular, when an
executable is busy on HPUX), rename it instead to .rsyncNNN. Most of the code was submitted by Ketil Kristiansen <ketil-k@osc.no>
Diffstat (limited to 'rsync.c')
-rw-r--r--rsync.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/rsync.c b/rsync.c
index d7f2d3ce..489afcf1 100644
--- a/rsync.c
+++ b/rsync.c
@@ -57,7 +57,7 @@ int delete_file(char *fname)
int ret;
extern int recurse;
- if (do_unlink(fname) == 0 || errno == ENOENT) return 0;
+ if (robust_unlink(fname) == 0 || errno == ENOENT) return 0;
#if SUPPORT_LINKS
ret = do_lstat(fname, &st);
@@ -262,7 +262,7 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file)
return;
/* move tmp file over real file */
- if (do_rename(fnametmp,fname) != 0) {
+ if (robust_rename(fnametmp,fname) != 0) {
if (errno == EXDEV) {
/* rename failed on cross-filesystem link.
Copy the file instead. */
@@ -272,12 +272,11 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file)
} else {
set_perms(fname,file,NULL,0);
}
- do_unlink(fnametmp);
} else {
rprintf(FERROR,"rename %s -> %s : %s\n",
fnametmp,fname,strerror(errno));
- do_unlink(fnametmp);
}
+ do_unlink(fnametmp);
} else {
set_perms(fname,file,NULL,0);
}