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

Re: svn commit: r8253 - trunk/subversion/svnlook

From: <kfogel_at_collab.net>
Date: 2004-01-12 17:09:34 CET

bliss@tigris.org writes:
> Fix the tmpdir problem that prevented running svnserve from a
> non-writable directory.
> [...]

Nice!

A thought:

> Modified: trunk/subversion/svnlook/main.c
>
> [...]
>
> +/* Create a new temporary directory with an 'svnlook' prefix. */
> +static svn_error_t *
> +create_unique_tmpdir (const char **name, apr_pool_t *pool)
> +{
> + const char *unique_name_apr;
> + const char *unique_name;
> + const char *sys_tmp_dir;
> + const char *base_apr;
> + const char *base;
> + unsigned int i;
> +
> + SVN_ERR (svn_io_temp_dir (&sys_tmp_dir, pool));
> + base = svn_path_join (sys_tmp_dir, "svnlook", pool);
> + SVN_ERR (svn_path_cstring_from_utf8 (&base_apr, base, pool));
> +
> + for (i = 1; i <= 99999; i++)
> + {
> + apr_status_t apr_err;
> +
> + unique_name_apr = apr_psprintf (pool, "%s.%u", base_apr, i);
> + apr_err = apr_dir_make (unique_name_apr, APR_OS_DEFAULT, pool);
> +
> + if (APR_STATUS_IS_EEXIST (apr_err))
> + continue;
> +
> + SVN_ERR (svn_path_cstring_to_utf8 (&unique_name, unique_name_apr, pool));
> +
> + if (apr_err)
> + {
> + *name = NULL;
> + return svn_error_wrap_apr (apr_err, "Can't create directory '%s'",
> + unique_name);
> + }
> + else
> + {
> + *name = unique_name;
> + return SVN_NO_ERROR;
> + }
> + }
> +
> + *name = NULL;
> + return svn_error_createf (SVN_ERR_IO_UNIQUE_NAMES_EXHAUSTED,
> + NULL, "Can't create temporary directory");
> +}

At some point, I think we'd want this to become a public api,
analogous to svn_io_open_unique_file().

Actually, now that I think about it, is there any reason not to make
it a public function right now? Avoiding API divergence between 1.0
and trunk is more about not changing existing functions -- but adding
a new function on trunk, even if it doesn't go into 1.0? Sure, I
don't see a problem with that...

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 12 18:04:36 2004

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.