You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/08/20 03:10:22 UTC
svn commit: r1696695 - /subversion/trunk/subversion/libsvn_fs_x/fs_id.c
Author: rhuijben
Date: Thu Aug 20 01:10:22 2015
New Revision: 1696695
URL: http://svn.apache.org/r1696695
Log:
Resolve a circular library reference issue in libsvn_fs_x, by using the passed
pointer to a function instead of the function by its name.
Found by: danielsh
(and jamessan on irc)
* subversion/libsvn_fs_x/fs_id.c
(svn_fs_x__id_context_t): Add function pointer.
(fs_cleanup): Store open pointer to allow reopening.
(get_fs): Use function pointer.
* subversion/libsvn_fs_x/fs_id.c
Modified:
subversion/trunk/subversion/libsvn_fs_x/fs_id.c
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_id.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_id.c?rev=1696695&r1=1696694&r2=1696695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_id.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_id.c Thu Aug 20 01:10:22 2015
@@ -85,6 +85,13 @@ struct svn_fs_x__id_context_t
is not.*/
const char *fs_path;
+ /* If FS is NULL, this points to svn_fs_open() as passed to the library. */
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **,
+ const char *,
+ apr_hash_t *,
+ apr_pool_t *,
+ apr_pool_t *);
+
/* Pool that this context struct got allocated in. */
apr_pool_t *owner;
@@ -118,11 +125,14 @@ static apr_status_t
fs_cleanup(void *baton)
{
svn_fs_x__id_context_t *context = baton;
+ svn_fs_x__data_t *ffd = context->fs->fsap_data;
/* Remember the FS_PATH to potentially reopen and mark the FS as n/a. */
context->fs_path = apr_pstrdup(context->owner, context->fs->path);
+ context->svn_fs_open_ = ffd->svn_fs_open_;
context->fs = NULL;
+
/* No need for further notifications because from now on, everything is
allocated in OWNER. */
apr_pool_cleanup_kill(context->owner, context, owner_cleanup);
@@ -137,8 +147,12 @@ get_fs(svn_fs_x__id_context_t *context)
{
if (!context->fs)
{
- svn_error_t *err = svn_fs_open2(&context->fs, context->fs_path, NULL,
- context->owner, context->owner);
+ svn_error_t *err;
+
+ SVN_ERR_ASSERT_NO_RETURN(context->svn_fs_open_);
+
+ err = context->svn_fs_open_(&context->fs, context->fs_path, NULL,
+ context->owner, context->owner);
if (err)
{
svn_error_clear(err);