summaryrefslogtreecommitdiff
path: root/cleanup.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-09 06:23:27 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-09 06:23:27 +0000
commitc6b81a9865b49f39f7d388ac64a8d74ce414081e (patch)
tree19884acaa0b9ff3be2bec548ef3a33e571b96b96 /cleanup.c
parente0414f42027769676cfd0a119eab2fa8e62f8e0f (diff)
downloadrsync-c6b81a9865b49f39f7d388ac64a8d74ce414081e.tar.gz
handle OSes where you can't rename a open file in the cleanup code.
Diffstat (limited to 'cleanup.c')
-rw-r--r--cleanup.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cleanup.c b/cleanup.c
index 05f34527..57fce18f 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -27,6 +27,8 @@ int cleanup_got_literal=0;
static char *cleanup_fname;
static char *cleanup_new_fname;
static struct file_struct *cleanup_file;
+static int cleanup_fd1, cleanup_fd2;
+static struct map_struct *cleanup_buf;
void exit_cleanup(int code)
{
@@ -37,6 +39,9 @@ void exit_cleanup(int code)
if (cleanup_got_literal && cleanup_fname && keep_partial) {
char *fname = cleanup_fname;
cleanup_fname = NULL;
+ if (cleanup_buf) unmap_file(cleanup_buf);
+ if (cleanup_fd1 != -1) close(cleanup_fd1);
+ if (cleanup_fd2 != -1) close(cleanup_fd2);
finish_transfer(cleanup_new_fname, fname, cleanup_file);
}
io_flush();
@@ -55,9 +60,13 @@ void cleanup_disable(void)
}
-void cleanup_set(char *fnametmp, char *fname, struct file_struct *file)
+void cleanup_set(char *fnametmp, char *fname, struct file_struct *file,
+ struct map_struct *buf, int fd1, int fd2)
{
cleanup_fname = fnametmp;
cleanup_new_fname = fname;
cleanup_file = file;
+ cleanup_buf = buf;
+ cleanup_fd1 = fd1;
+ cleanup_fd2 = fd2;
}