From 212defd763e424078edb404eccfaac60bb8d7dde Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 6 Jun 2008 10:27:15 +0200 Subject: [PATCH] Create a new temporary file name if the file already exists. --- src/csync_propagate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/csync_propagate.c b/src/csync_propagate.c index 6de1b41757..c8abc369d7 100644 --- a/src/csync_propagate.c +++ b/src/csync_propagate.c @@ -119,12 +119,14 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) { goto out; } turi = mktemp(turi); - CSYNC_LOG(CSYNC_LOG_PRIORITY_NOTICE, "file: %s", turi); /* Open the destination file */ ctx->replica = drep; while ((dfp = csync_vio_open(ctx, turi, O_CREAT|O_EXCL|O_WRONLY, st->mode)) == NULL) { switch (errno) { + case EEXIST: + turi = mktemp(turi); + break; case ENOENT: break; case ENOMEM: