You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2013/12/05 16:38:46 UTC

svn commit: r1548170 - /subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c

Author: philip
Date: Thu Dec  5 15:38:46 2013
New Revision: 1548170

URL: http://svn.apache.org/r1548170
Log:
* subversion/libsvn_fs_fs/rep-cache.c
  (open_rep_cache): Use permissions of 'current' file for new file.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c?rev=1548170&r1=1548169&r2=1548170&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Thu Dec  5 15:38:46 2013
@@ -83,6 +83,31 @@ open_rep_cache(void *baton,
   /* Open (or create) the sqlite database.  It will be automatically
      closed when fs->pool is destoyed.  */
   db_path = path_rep_cache_db(fs->path, pool);
+#ifndef WIN32
+  {
+    /* We want to extend the permissions that apply to the repository
+       as a whole when creating a new rep cache and not simply default
+       to umask. */
+    svn_boolean_t exists;
+
+    SVN_ERR(svn_fs_fs__exists_rep_cache(&exists, fs, pool));
+    if (!exists)
+      {
+        const char *current = svn_fs_fs__path_current(fs, pool);
+        svn_error_t *err = svn_io_file_create_empty(db_path, pool);
+
+        if (err && !APR_STATUS_IS_EEXIST(err->apr_err))
+          /* A real error. */
+          return svn_error_trace(err);
+        else if (err)
+          /* Some other thread/process created the file. */
+          svn_error_clear(err);
+        else
+          /* We created the file. */
+          SVN_ERR(svn_io_copy_perms(current, db_path, pool));
+      }
+  }
+#endif
   SVN_ERR(svn_sqlite__open(&sdb, db_path,
                            svn_sqlite__mode_rwcreate, statements,
                            0, NULL,