FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/rev_file.c
/* If the file at PATH is read-only, attempt to make it writable.  The
 * original state will be restored with RESULT_POOL gets cleaned up.
 * SCRATCH_POOL is for temporary allocations. */
If the file at PATH is read-only, attempt to make it writable.  The
original state will be restored with RESULT_POOL gets cleaned up.
SCRATCH_POOL is for temporary allocations.
If the file at PATH is read - only attempt to make it writable . The original state will be restored with RESULT_POOL gets cleaned up . SCRATCH_POOL is for temporary allocations .
static svn_error_t *
auto_make_writable(const char *path,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
{
  svn_boolean_t is_read_only;
  apr_finfo_t finfo;
  SVN_ERR(svn_io_stat(&finfo, path, SVN__APR_FINFO_READONLY, scratch_pool));
  SVN_ERR(svn_io__is_finfo_read_only(&is_read_only, &finfo, scratch_pool));
  if (is_read_only)
    {
      set_read_only_baton_t *baton = apr_pcalloc(result_pool,
                                                  sizeof(*baton));
      baton->pool = result_pool;
      baton->file_path = apr_pstrdup(result_pool, path);
      apr_pool_cleanup_register(result_pool, baton,
                                set_read_only, apr_pool_cleanup_null);
      SVN_ERR(svn_io_set_file_read_write(path, FALSE, scratch_pool));
    }
  return SVN_NO_ERROR;
}
static svn_error_t * auto_make_writable ( const char * path , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_boolean_t is_read_only ; apr_finfo_t finfo ; SVN_ERR ( svn_io_stat ( & finfo , path , SVN__APR_FINFO_READONLY , scratch_pool ) ) ; SVN_ERR ( svn_io__is_finfo_read_only ( & is_read_only , & finfo , scratch_pool ) ) ; if ( is_read_only ) { set_read_only_baton_t * baton = apr_pcalloc ( result_pool , sizeof ( * baton ) ) ; baton -> pool = result_pool ; baton -> file_path = apr_pstrdup ( result_pool , path ) ; apr_pool_cleanup_register ( result_pool , baton , set_read_only , apr_pool_cleanup_null ) ; SVN_ERR ( svn_io_set_file_read_write ( path , FALSE , scratch_pool ) ) ; } return SVN_NO_ERROR ; }
If the file at PATH is read-only, attempt to make it writable.
If the file at PATH is read - only attempt to make it writable .
/* Tell the pool to restore the r/o state upon cleanup
         (assuming the file will still exist, failing silently otherwise). */ /* Finally, allow write access (undoing it has already been scheduled
         and is idempotent). */