diff options
author | David Dykstra <dwd@samba.org> | 1999-03-11 22:17:42 +0000 |
---|---|---|
committer | David Dykstra <dwd@samba.org> | 1999-03-11 22:17:42 +0000 |
commit | c7c11a0d4c315a052dddf97cc6d3d63a54b4a831 (patch) | |
tree | 44df2879171d94040aed046a24cdd19f8d04ae88 /rsync.c | |
parent | c27f25922e9f59e439228a3c3e0c38342899a80f (diff) | |
download | rsync-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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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); } |