[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r12734 - branches/locking/subversion/libsvn_fs_fs

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-01-15 01:41:08 CET

fitz@tigris.org writes:

> Author: fitz
> Date: Fri Jan 14 13:41:54 2005
> New Revision: 12734

> +/* Create a directory at PATH with the same permissions as
> + REF_PATH. */
> +static svn_error_t *
> +make_dir (const char *path,
> + const char *ref_path,
> + apr_pool_t *pool)
> +{
> + svn_error_t *err;
> +
> + err = svn_io_dir_make (path, APR_OS_DEFAULT, pool);
> +
> + /* If no error, then we successfully created the directory--tweak
> + the perms.*/
> + if (!err)
> + SVN_ERR (svn_fs_fs__dup_perms (path, ref_path, pool));
> +
> + /* Any error other than EEXIST is a real error. */
> + if (err && !APR_STATUS_IS_EEXIST (err->apr_err))
> + return err;
> +
> + /* If EEXIST, then clear the error */
> + if (err && APR_STATUS_IS_EEXIST (err->apr_err))

Having decided not to return the error don't use another if, simply
call svn_error_clear unconditionally (it handles a NULL argument).

I had to read this bit of code more than once to understand it, if
somebody ever changes the first EEXIST test they may forget to change
the second one.

> + svn_error_clear (err);
> +
> + return SVN_NO_ERROR;
> +}
> +

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jan 15 01:42:21 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.