From bb03664bfd679970c12cadc3acd157bbeb385d59 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 6 Jun 2013 09:34:54 +0200 Subject: [PATCH] Let csync_update report the right error. The problem is that the call to csync_memstat_check will try to open a file, that will fail on windows and override the errno --- src/csync.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/csync.c b/src/csync.c index d13799e7f..de6d03789 100644 --- a/src/csync.c +++ b/src/csync.c @@ -402,6 +402,11 @@ int csync_update(CSYNC *ctx) { ctx->replica = ctx->local.type; rc = csync_ftw(ctx, ctx->local.uri, csync_walker, MAX_DEPTH); + if (rc < 0) { + if(ctx->error_code == CSYNC_ERR_NONE) + ctx->error_code = csync_errno_to_csync_error(CSYNC_ERR_UPDATE); + return -1; + } csync_gettime(&finish); @@ -410,11 +415,6 @@ int csync_update(CSYNC *ctx) { c_secdiff(finish, start), c_rbtree_size(ctx->local.tree)); csync_memstat_check(ctx); - if (rc < 0) { - if(ctx->error_code == CSYNC_ERR_NONE) - ctx->error_code = csync_errno_to_csync_error(CSYNC_ERR_UPDATE); - return -1; - } /* update detection for remote replica */ if( ! ctx->options.local_only_mode ) { @@ -423,6 +423,11 @@ int csync_update(CSYNC *ctx) { ctx->replica = ctx->remote.type; rc = csync_ftw(ctx, ctx->remote.uri, csync_walker, MAX_DEPTH); + if (rc < 0) { + if(ctx->error_code == CSYNC_ERR_NONE ) + ctx->error_code = csync_errno_to_csync_error(CSYNC_ERR_UPDATE); + return -1; + } csync_gettime(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, @@ -431,11 +436,6 @@ int csync_update(CSYNC *ctx) { c_secdiff(finish, start), c_rbtree_size(ctx->remote.tree)); csync_memstat_check(ctx); - if (rc < 0) { - if(ctx->error_code == CSYNC_ERR_NONE ) - ctx->error_code = csync_errno_to_csync_error(CSYNC_ERR_UPDATE); - return -1; - } } ctx->status |= CSYNC_STATUS_UPDATE;