You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@codematters.co.uk> on 2005/01/15 00:41:08 UTC

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

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

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

Posted by "Brian W. Fitzpatrick" <fi...@red-bean.com>.
On Jan 14, 2005, at 6:41 PM, Philip Martin wrote:

> 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.

Committed in r12769.

Thanks,

-Fitz


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org