Fix potential crash in case of abort while update:

We need to reset ctx->remote.read_from_db  BEFORE caling vio_closedir
Otherwise, it may interpret the handle as a 'bdtree' handle instead of
a owncloud handle.

Should fix #1442
This commit is contained in:
Olivier Goffart 2014-02-21 16:57:24 +01:00
Родитель cd13144415
Коммит a71cb1d3ef
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -598,7 +598,6 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
ctx->status_code = CSYNC_STATUS_UPDATE_ERROR;
}
csync_vio_closedir(ctx, dh);
ctx->current_fs = previous_fs;
goto done;
}
@ -608,7 +607,6 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
rc = csync_ftw(ctx, filename, fn, depth - 1);
if (rc < 0) {
ctx->current_fs = previous_fs;
csync_vio_closedir(ctx, dh);
goto done;
}
@ -637,6 +635,9 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
done:
ctx->remote.read_from_db = read_from_db;
if (dh != NULL) {
csync_vio_closedir(ctx, dh);
}
csync_vio_file_stat_destroy(dirent);
SAFE_FREE(filename);
return rc;