Author: philip
Date: Thu Jan 10 11:10:28 2013
New Revision: 1431279

URL: http://svn.apache.org/viewvc?rev=1431279&view=rev
Log:
Ensure wc.db has the permissions allowed by umask.

* subversion/libsvn_wc/wc_db_util.c
  (svn_wc__db_util_open_db): Ensure wc.db exists before it is opened by SQLite.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_util.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_util.c?rev=1431279&r1=1431278&r2=1431279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_util.c Thu Jan 10 11:10:28 2013
@@ -136,6 +136,22 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
                                  svn_dirent_local_style(sdb_abspath,
                                                         scratch_pool));
     }
+#ifndef WIN32
+  else
+    {
+      apr_file_t *f;
+
+      /* A standard SQLite build creates a DB with mode 644 ^ !umask
+         which means the file doesn't have group/world write access
+         even when umask allows it. By ensuring the file exists before
+         SQLite gets involved we give it the permissions allowed by
+         umask. */
+      SVN_ERR(svn_io_file_open(&f, sdb_abspath,
+                               (APR_READ | APR_WRITE | APR_CREATE),
+                               APR_OS_DEFAULT, scratch_pool));
+      SVN_ERR(svn_io_file_close(f, scratch_pool));
+    }
+#endif
 
   SVN_ERR(svn_sqlite__open(sdb, sdb_abspath, smode,
                            my_statements ? my_statements : statements,


Reply via email to