Just use svn_io_file_move() instead of all this.
On Fri, Sep 18, 2009 at 08:02, Stefan Sperling <stsp_at_elego.de> wrote:
> Author: stsp
> Date: Fri Sep 18 05:02:07 2009
> New Revision: 39430
>
> Log:
> * subversion/libsvn_client/patch.c
> Â (apply_one_patch): If renaming the patched result on top of the target
> Â file fails, try copy+delete before giving up.
>
> Modified:
> Â trunk/subversion/libsvn_client/patch.c
>
> Modified: trunk/subversion/libsvn_client/patch.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/patch.c?pathrev=39430&r1=39429&r2=39430
> ==============================================================================
> --- trunk/subversion/libsvn_client/patch.c    Fri Sep 18 04:44:22 2009     (r39429)
> +++ trunk/subversion/libsvn_client/patch.c    Fri Sep 18 05:02:07 2009     (r39430)
> @@ -1010,10 +1010,24 @@ apply_one_patch(svn_patch_t *patch, cons
> Â Â Â Â Â Â Â Â Â Â }
> Â Â Â Â Â Â Â Â Â else
> Â Â Â Â Â Â Â Â Â Â {
> + Â Â Â Â Â Â Â Â Â Â Â svn_error_t *err;
> +
> Â Â Â Â Â Â Â Â Â Â Â /* Install patched temporary file over working file.
> Â Â Â Â Â Â Â Â Â Â Â Â * ### Should this rather be done in a loggy fashion? */
> - Â Â Â Â Â Â Â Â Â Â Â SVN_ERR(svn_io_file_rename(target->result_path,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â target->abs_path, pool));
> + Â Â Â Â Â Â Â Â Â Â Â err = svn_io_file_rename(target->result_path,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â target->abs_path, pool);
> + Â Â Â Â Â Â Â Â Â Â Â if (err)
> + Â Â Â Â Â Â Â Â Â Â Â Â {
> + Â Â Â Â Â Â Â Â Â Â Â Â Â /* Renaming failed, try to copy+delete instead.
> + Â Â Â Â Â Â Â Â Â Â Â Â Â * We may have attempted a cross-device rename. */
> + Â Â Â Â Â Â Â Â Â Â Â Â Â svn_error_clear(err);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â SVN_ERR(svn_io_copy_file(target->result_path,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â target->abs_path, FALSE,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pool));
> + Â Â Â Â Â Â Â Â Â Â Â Â Â SVN_ERR(svn_io_remove_file2(target->result_path,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â FALSE, pool));
> + Â Â Â Â Â Â Â Â Â Â Â Â }
> +
> Â Â Â Â Â Â Â Â Â Â Â if (target->executable)
> Â Â Â Â Â Â Â Â Â Â Â Â SVN_ERR(svn_io_set_file_executable(target->abs_path,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â TRUE, FALSE, pool));
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2396389
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2396586
Received on 2009-09-18 21:14:06 CEST