You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2016/10/06 14:54:28 UTC

svn commit: r1763599 - /subversion/trunk/subversion/svn/conflict-callbacks.c

Author: kotkov
Date: Thu Oct  6 14:54:28 2016
New Revision: 1763599

URL: http://svn.apache.org/viewvc?rev=1763599&view=rev
Log:
Fix sharing violation error when merging property values with notepad
on Windows.

The error is caused by keeping the file handle open when calling the
extenal editor (editor-cmd).  With notepad, an attempt to save the edited
file results in a sharing violation error upon CreateFile() caused by the
svn process still having the open file handle.

* subversion/svn/conflict-callbacks.c
  (edit_prop_conflict): Take ownership of the apr_file_t when opening a
   stream, so that closing the stream would also close the underlying file.
   Remove the svn_io_file_flush() call, because closing a buffered file
   performs a flush automatically.

Modified:
    subversion/trunk/subversion/svn/conflict-callbacks.c

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1763599&r1=1763598&r2=1763599&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Thu Oct  6 14:54:28 2016
@@ -346,7 +346,7 @@ edit_prop_conflict(const svn_string_t **
   SVN_ERR(svn_io_open_unique_file3(&file, &file_path, NULL,
                                    svn_io_file_del_on_pool_cleanup,
                                    scratch_pool, scratch_pool));
-  merged_prop = svn_stream_from_aprfile2(file, TRUE /* disown */,
+  merged_prop = svn_stream_from_aprfile2(file, FALSE /* disown */,
                                          scratch_pool);
   SVN_ERR(merge_prop_conflict(merged_prop, base_propval, my_propval,
                               their_propval, NULL,
@@ -354,7 +354,6 @@ edit_prop_conflict(const svn_string_t **
                               pb->cancel_baton,
                               scratch_pool));
   SVN_ERR(svn_stream_close(merged_prop));
-  SVN_ERR(svn_io_file_flush(file, scratch_pool));
   SVN_ERR(open_editor(&performed_edit, file_path, editor_cmd,
                       config, scratch_pool));
   if (performed_edit && merged_propval)