From: Klaas Freitag Date: Wed, 9 Sep 2015 12:12:13 +0000 (+0200) Subject: csync_update: Handle permission denied as soft error in discovery. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1408^2~110 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=df534753b171f0b714221397e15a0f8e094bdeaf;p=nextcloud-desktop.git csync_update: Handle permission denied as soft error in discovery. For that, treat the not accessible directory as if it were ignored. This will fix #3767 --- diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 9d347b3c2..8b9a4b9ec 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -630,7 +630,16 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, /* permission denied */ ctx->status_code = csync_errno_to_status(errno, CSYNC_STATUS_OPENDIR_ERROR); if (errno == EACCES) { - return 0; + if (ctx->current_fs) { + ctx->current_fs->instruction = CSYNC_INSTRUCTION_IGNORE; + ctx->current_fs->error_status = CSYNC_STATUS_PERMISSION_DENIED; + /* If a directory has ignored files, put the flag on the parent directory as well */ + if( previous_fs ) { + previous_fs->has_ignored_files = true; + } + } + goto done; + // previously return 0; } else if(errno == ENOENT) { asp = asprintf( &ctx->error_string, "%s", uri); if (asp < 0) { diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 62f6c108e..d6b7a6459 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -414,6 +414,10 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote ) item->_status = SyncFileItem::SoftError; _temporarilyUnavailablePaths.insert(item->_file); break; + case CSYNC_STATUS_PERMISSION_DENIED: + item->_errorString = QLatin1String("Directory not accessible on client, permission denied."); + item->_status = SyncFileItem::SoftError; + break; default: Q_ASSERT("Non handled error-status"); /* No error string */