csync_update: Handle permission denied as soft error in discovery.
authorKlaas Freitag <freitag@owncloud.com>
Wed, 9 Sep 2015 12:12:13 +0000 (14:12 +0200)
committerKlaas Freitag <freitag@owncloud.com>
Wed, 9 Sep 2015 12:12:13 +0000 (14:12 +0200)
For that, treat the not accessible directory as if it were ignored.

This will fix #3767

csync/src/csync_update.c
src/libsync/syncengine.cpp

index 9d347b3c284113e7a73ac973e12701766be4202d..8b9a4b9ec770fcc6724cc5a4b8379fbc9617ca44 100644 (file)
@@ -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) {
index 62f6c108eabb45d1afc91cb8f7d409b832681647..d6b7a6459ddffff669fef1e60df38552cb6c4285 100644 (file)
@@ -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 */