Make sure that we can't run in an infinite loop.

This commit is contained in:
Andreas Schneider 2008-06-06 13:23:42 +02:00
parent 4adb536048
commit 7f003c1277

View file

@ -123,8 +123,13 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
/* Create the destination file */ /* Create the destination file */
ctx->replica = drep; ctx->replica = drep;
while ((dfp = csync_vio_open(ctx, turi, O_CREAT|O_EXCL|O_WRONLY, st->mode)) == NULL) { while ((dfp = csync_vio_open(ctx, turi, O_CREAT|O_EXCL|O_WRONLY, st->mode)) == NULL) {
int count = 0;
switch (errno) { switch (errno) {
case EEXIST: case EEXIST:
if (count++ > 10) {
rc = 1;
goto out;
}
turi = mktemp(turi); turi = mktemp(turi);
break; break;
case ENOENT: case ENOENT: