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

RE: svn commit: r1505006 - in /subversion/trunk: ./ subversion/include/svn_io.h [2]

From: Bert Huijben <bert_at_qqmail.nl>
Date: Sat, 20 Jul 2013 00:11:08 +0200

> -----Original Message-----
> From: stefan2_at_apache.org [mailto:stefan2_at_apache.org]
> Sent: vrijdag 19 juli 2013 22:46
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1505006 - in /subversion/trunk: ./
> subversion/include/svn_io.h subversion/libsvn_client/patch.c
> subversion/libsvn_fs_fs/fs_fs.c subversion/libsvn_subr/io.c
>
> Author: stefan2
> Date: Fri Jul 19 20:46:22 2013
> New Revision: 1505006
>
> URL: http://svn.apache.org/r1505006
> Log:
> Merge revisions r1433848,1438408,1445080 from branches/fsfs-format7.
> These introduce svn_io_file_create_empty and svn_io_file_create_binary
> as alternatives to svn_io_file_create.
>
> A few conflicts had to be resolved.

<snip>
Second reply:

> {
> apr_file_t *f;
> apr_size_t written;
> @@ -1178,16 +1179,28 @@ svn_error_t *svn_io_file_create(const ch
> (APR_WRITE | APR_CREATE | APR_EXCL),
> APR_OS_DEFAULT,
> pool));
> - if (contents && *contents)
> - err = svn_io_file_write_full(f, contents, strlen(contents),
> - &written, pool);
> -
> + if (length)
> + err = svn_io_file_write_full(f, contents, length, &written, pool);
>
> return svn_error_trace(
> svn_error_compose_create(err,
> svn_io_file_close(f, pool)));

Not really related to this patch, but it is probably better to try to delete the new file when writing the initial data failed here.

Otherwise we will just leave a file on disk where nobody will look after, because the user of this function can't really determine in which stage the create failed.

        Bert
Received on 2013-07-20 00:12:04 CEST

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