On Wed, Mar 17, 2010 at 04:40:51PM -0000, rhuij...@apache.org wrote: > Author: rhuijben > Date: Wed Mar 17 16:40:51 2010 > New Revision: 924360 > > URL: http://svn.apache.org/viewvc?rev=924360&view=rev > Log: > Make svn_io_file_mktemp() behave in the same way on all operating > systems. > > * subversion/include/svn_io.h > (svn_io_file_mktemp): Make templ const. > > * subversion/libsvn_subr/io.c > (svn_io_file_mktemp): > Update prototype. Use svn_path_cstring_from_utf8(), which makes a > local copy on all operating systems, to make sure apr never tries to > overwrite read only memory on systems with a utf-8 filesystem api in > apr (such as Mac/OS X and Windows).
It would be nice to have the last sentence from the log message as a comment in the code also. It's not obvious that we depend on this side-effect of svn_path_cstring_from_utf8() otherwise. Thanks, Stefan > > Modified: > subversion/trunk/subversion/include/svn_io.h > subversion/trunk/subversion/libsvn_subr/io.c > > Modified: subversion/trunk/subversion/include/svn_io.h > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=924360&r1=924359&r2=924360&view=diff > ============================================================================== > --- subversion/trunk/subversion/include/svn_io.h (original) > +++ subversion/trunk/subversion/include/svn_io.h Wed Mar 17 16:40:51 2010 > @@ -1904,7 +1904,7 @@ svn_io_write_version_file(const char *pa > * @since New in 1.7. */ > svn_error_t * > svn_io_file_mktemp(apr_file_t **new_file, > - char *templ, > + const char *templ, > apr_int32_t flags, > apr_pool_t *pool); > > > Modified: subversion/trunk/subversion/libsvn_subr/io.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=924360&r1=924359&r2=924360&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_subr/io.c (original) > +++ subversion/trunk/subversion/libsvn_subr/io.c Wed Mar 17 16:40:51 2010 > @@ -3525,13 +3525,13 @@ svn_io_files_contents_same_p(svn_boolean > > /* Wrapper for apr_file_mktemp(). */ > svn_error_t * > -svn_io_file_mktemp(apr_file_t **new_file, char *templ, > +svn_io_file_mktemp(apr_file_t **new_file, const char *templ, > apr_int32_t flags, apr_pool_t *pool) > { > const char *templ_apr; > apr_status_t status; > > - SVN_ERR(cstring_from_utf8(&templ_apr, templ, pool)); > + SVN_ERR(svn_path_cstring_from_utf8(&templ_apr, templ, pool)); > > /* ### I don't want to copy the template string again just to > * make it writable... so cast away const. > -- printf("Eh???/n");