You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/02/25 16:51:32 UTC
svn commit: r1074591 - in /subversion/trunk/subversion: include/svn_error.h
svnsync/main.c
Author: philip
Date: Fri Feb 25 15:51:32 2011
New Revision: 1074591
URL: http://svn.apache.org/viewvc?rev=1074591&view=rev
Log:
Calling svn_error_compose_create with two functions as parameters
allows the functions to be called in either order. This is usually
a bug, and was a bug in svnsync.
* subversion/include/svn_error.h
(svn_error_compose_create, svn_error_compose): Add comment about
potential usage error.
* subversion/svnsync/main.c
(with_locked): Avoid undefined order of evaluation problem.
Modified:
subversion/trunk/subversion/include/svn_error.h
subversion/trunk/subversion/svnsync/main.c
Modified: subversion/trunk/subversion/include/svn_error.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error.h?rev=1074591&r1=1074590&r2=1074591&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error.h (original)
+++ subversion/trunk/subversion/include/svn_error.h Fri Feb 25 15:51:32 2011
@@ -148,6 +148,10 @@ svn_error_quick_wrap(svn_error_t *child,
* @a err2 may be @c SVN_NO_ERROR. If both are not @c SVN_NO_ERROR,
* @a err2 will follow @a err1 in the chain of the returned error.
*
+ * Either @a err1 or @a err2 can be functions that return svn_error_t*
+ * but if both are functions they can be evaluated in either order as
+ * per the C language rules.
+ *
* @since New in 1.6.
*/
svn_error_t *
@@ -157,6 +161,10 @@ svn_error_compose_create(svn_error_t *er
/** Add @a new_err to the end of @a chain's chain of errors. The @a new_err
* chain will be copied into @a chain's pool and destroyed, so @a new_err
* itself becomes invalid after this function.
+ *
+ * Either @a chain or @a new_err can be functions that return svn_error_t*
+ * but if both are functions they can be evaluated in either order as
+ * per the C language rules.
*/
void
svn_error_compose(svn_error_t *chain,
Modified: subversion/trunk/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/main.c?rev=1074591&r1=1074590&r2=1074591&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/main.c (original)
+++ subversion/trunk/subversion/svnsync/main.c Fri Feb 25 15:51:32 2011
@@ -393,11 +393,12 @@ with_locked(svn_ra_session_t *session,
apr_pool_t *pool)
{
const svn_string_t *lock_string;
+ svn_error_t *err;
SVN_ERR(get_lock(&lock_string, session, steal_lock, pool));
- return svn_error_compose_create(
- func(session, baton, pool),
+ err = func(session, baton, pool);
+ return svn_error_compose_create(err,
svn_ra__release_operational_lock(session, SVNSYNC_PROP_LOCK,
lock_string, pool));
}