You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/11/10 17:00:57 UTC

svn commit: r1033547 - in /subversion/trunk/subversion/mod_dav_svn: activity.c dav_svn.h deadprops.c lock.c reports/dated-rev.c reports/deleted-rev.c reports/get-locks.c repos.c util.c version.c

Author: cmpilato
Date: Wed Nov 10 16:00:56 2010
New Revision: 1033547

URL: http://svn.apache.org/viewvc?rev=1033547&view=rev
Log:
Wrap mod_dav_svn's use of the mod_dav error APIs with a compatibility
shim to enable compilation against Apache trunk (2.4-to-be).  (This
patch was tracked in issue #3548.)

NOTE: I didn't attempt to correct indentation in this commit.  Will do
a whitepace-only followup commit.

* subversion/mod_dav_svn/dav_svn.h,
* subversion/mod_dav_svn/util.c
  (dav_svn__new_error): New compatibility wrapper function for
    dav_new_error().  (All consumers of the latter tweaked to use the former.)
  (dav_svn__new_error_tag): Add compile-time compatibility codepaths
    to handle changes in the dav_new_error_tag() API.

* subversion/mod_dav_svn/activity.c,
* subversion/mod_dav_svn/deadprops.c,
* subversion/mod_dav_svn/lock.c,
* subversion/mod_dav_svn/repos.c,
* subversion/mod_dav_svn/version.c,
* subversion/mod_dav_svn/reports/dated-rev.c,
* subversion/mod_dav_svn/reports/deleted-rev.c,
* subversion/mod_dav_svn/reports/get-locks.c
  Update caller of dav_new_error() to use dav_svn__new_error().

Patch by: Jeff Trawick <tr...@gmail.com>
          (Tweaked by me.)

Modified:
    subversion/trunk/subversion/mod_dav_svn/activity.c
    subversion/trunk/subversion/mod_dav_svn/dav_svn.h
    subversion/trunk/subversion/mod_dav_svn/deadprops.c
    subversion/trunk/subversion/mod_dav_svn/lock.c
    subversion/trunk/subversion/mod_dav_svn/reports/dated-rev.c
    subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c
    subversion/trunk/subversion/mod_dav_svn/reports/get-locks.c
    subversion/trunk/subversion/mod_dav_svn/repos.c
    subversion/trunk/subversion/mod_dav_svn/util.c
    subversion/trunk/subversion/mod_dav_svn/version.c

Modified: subversion/trunk/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/activity.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/activity.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/activity.c Wed Nov 10 16:00:56 2010
@@ -164,8 +164,8 @@ dav_svn__delete_activity(const dav_svn_r
   txn_name = read_txn(pathname, repos->pool);
   if (txn_name == NULL)
     {
-      return dav_new_error(repos->pool, HTTP_NOT_FOUND, 0,
-                           "could not find activity.");
+      return dav_svn__new_error(repos->pool, HTTP_NOT_FOUND, 0,
+                                "could not find activity.");
     }
 
   /* After this point, we have to cleanup the value and database. */

Modified: subversion/trunk/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/dav_svn.h?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/trunk/subversion/mod_dav_svn/dav_svn.h Wed Nov 10 16:00:56 2010
@@ -723,6 +723,19 @@ dav_svn__new_error_tag(apr_pool_t *pool,
                        const char *tagname);
 
 
+/* A wrapper around mod_dav's dav_new_error, mod_dav_svn uses this
+   instead of the mod_dav function to enable special mod_dav_svn specific
+   processing.  See dav_new_error for parameter documentation.
+   Note that DESC may be null (it's hard to track this down from
+   dav_new_error()'s documentation, but see the dav_error type,
+   which says that its desc field may be NULL). */
+dav_error *
+dav_svn__new_error(apr_pool_t *pool,
+                   int status,
+                   int errno_id,
+                   const char *desc);
+
+
 /* Convert an svn_error_t into a dav_error, pushing another error based on
    MESSAGE if MESSAGE is not NULL.  Use the provided HTTP status for the
    DAV errors.  Allocate new DAV errors from POOL.

Modified: subversion/trunk/subversion/mod_dav_svn/deadprops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/deadprops.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/deadprops.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/deadprops.c Wed Nov 10 16:00:56 2010
@@ -178,7 +178,7 @@ save_value(dav_db *db, const dav_prop_na
         /* ignore the unknown namespace of the incoming prop. */
         propname = name->name;
       else
-        return dav_new_error(db->p, HTTP_CONFLICT, 0,
+        return dav_svn__new_error(db->p, HTTP_CONFLICT, 0,
                              "Properties may only be defined in the "
                              SVN_DAV_PROP_NS_SVN " and " SVN_DAV_PROP_NS_CUSTOM
                              " namespaces.");
@@ -300,7 +300,7 @@ db_open(apr_pool_t *p,
          changing unversioned rev props.  Remove this someday: see IZ #916. */
       if (! (resource->baselined
              && resource->type == DAV_RESOURCE_TYPE_VERSION))
-        return dav_new_error(p, HTTP_CONFLICT, 0,
+        return dav_svn__new_error(p, HTTP_CONFLICT, 0,
                              "Properties may only be changed on working "
                              "resources.");
     }
@@ -451,7 +451,7 @@ decode_property_value(const svn_string_t
             *out_propval_p = svn_base64_decode_string(maybe_encoded_propval,
                                                       pool);
           else
-            return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+            return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                                  "Unknown property encoding");
           break;
         }
@@ -498,7 +498,7 @@ db_store(dav_db *db,
 
   if (absent && ! elem->first_child)
     /* ### better error check */
-    return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                          apr_psprintf(pool, 
                                       "'%s' cannot be specified on the value "
                                       "without specifying an expectation",

Modified: subversion/trunk/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/lock.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/lock.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/lock.c Wed Nov 10 16:00:56 2010
@@ -143,7 +143,7 @@ unescape_xml(const char **output,
     {
       char errbuf[1024];
       (void)apr_xml_parser_geterror(xml_parser, errbuf, sizeof(errbuf));
-      return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
+      return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
                            DAV_ERR_LOCK_SAVE_LOCK, errbuf);
     }
 
@@ -166,12 +166,12 @@ dav_lock_to_svn_lock(svn_lock_t **slock,
 
   /* Sanity checks */
   if (dlock->type != DAV_LOCKTYPE_WRITE)
-    return dav_new_error(pool, HTTP_BAD_REQUEST,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Only 'write' locks are supported.");
 
   if (dlock->scope != DAV_LOCKSCOPE_EXCLUSIVE)
-    return dav_new_error(pool, HTTP_BAD_REQUEST,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Only exclusive locks are supported.");
 
@@ -460,7 +460,7 @@ get_locks(dav_lockdb *lockdb,
      anything about locks attached to it.*/
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
@@ -521,7 +521,7 @@ find_lock(dav_lockdb *lockdb,
      anything about locks attached to it.*/
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
@@ -538,7 +538,7 @@ find_lock(dav_lockdb *lockdb,
     {
       /* Sanity check. */
       if (strcmp(locktoken->uuid_str, slock->token) != 0)
-        return dav_new_error(resource->pool, HTTP_BAD_REQUEST,
+        return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
                              DAV_ERR_LOCK_SAVE_LOCK,
                              "Incoming token doesn't match existing lock.");
 
@@ -600,7 +600,7 @@ has_locks(dav_lockdb *lockdb, const dav_
      anything about locks attached to it.*/
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
@@ -644,12 +644,12 @@ append_locks(dav_lockdb *lockdb,
      be created on it. */
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
   if (lock->next)
-    return dav_new_error(resource->pool, HTTP_BAD_REQUEST,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Tried to attach multiple locks to a resource.");
 
@@ -669,13 +669,13 @@ append_locks(dav_lockdb *lockdb,
                                                           resource->pool));
 
       if (resource->info->repos->is_svn_client)
-        return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
+        return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
                              DAV_ERR_LOCK_SAVE_LOCK,
                              "Subversion clients may not lock "
                              "nonexistent paths.");
 
       else if (! resource->info->repos->autoversioning)
-        return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
+        return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
                              DAV_ERR_LOCK_SAVE_LOCK,
                              "Attempted to lock non-existent path;"
                              " turn on autoversioning first.");
@@ -746,7 +746,7 @@ append_locks(dav_lockdb *lockdb,
   if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
     {
       svn_error_clear(serr);
-      return dav_new_error(resource->pool, HTTP_UNAUTHORIZED,
+      return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
                            DAV_ERR_LOCK_SAVE_LOCK,
                            "Anonymous lock creation is not allowed.");
     }
@@ -812,7 +812,7 @@ remove_lock(dav_lockdb *lockdb,
      be removed from it. */
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
@@ -849,7 +849,7 @@ remove_lock(dav_lockdb *lockdb,
       if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
         {
           svn_error_clear(serr);
-          return dav_new_error(resource->pool, HTTP_UNAUTHORIZED,
+          return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
                                DAV_ERR_LOCK_SAVE_LOCK,
                                "Anonymous lock removal is not allowed.");
         }
@@ -898,7 +898,7 @@ refresh_locks(dav_lockdb *lockdb,
      anything about locks attached to it.*/
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
-    return dav_new_error(resource->pool, HTTP_FORBIDDEN,
+    return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Path is not accessible.");
 
@@ -916,7 +916,7 @@ refresh_locks(dav_lockdb *lockdb,
      current lock on the incoming resource? */
   if ((! slock)
       || (strcmp(token->uuid_str, slock->token) != 0))
-    return dav_new_error(resource->pool, HTTP_UNAUTHORIZED,
+    return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
                          DAV_ERR_LOCK_SAVE_LOCK,
                          "Lock refresh request doesn't match existing lock.");
 
@@ -936,7 +936,7 @@ refresh_locks(dav_lockdb *lockdb,
   if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
     {
       svn_error_clear(serr);
-      return dav_new_error(resource->pool, HTTP_UNAUTHORIZED,
+      return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
                            DAV_ERR_LOCK_SAVE_LOCK,
                            "Anonymous lock refreshing is not allowed.");
     }

Modified: subversion/trunk/subversion/mod_dav_svn/reports/dated-rev.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/dated-rev.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/dated-rev.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/dated-rev.c Wed Nov 10 16:00:56 2010
@@ -80,7 +80,7 @@ dav_svn__dated_rev_report(const dav_reso
 
   if (tm == (apr_time_t) -1)
     {
-      return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                            "The request does not contain a valid "
                            "'DAV:" SVN_DAV__CREATIONDATE "' element.");
     }
@@ -90,7 +90,7 @@ dav_svn__dated_rev_report(const dav_reso
                                       resource->pool)) != SVN_NO_ERROR)
     {
       svn_error_clear(err);
-      return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                            "Could not access revision times.");
     }
 

Modified: subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c Wed Nov 10 16:00:56 2010
@@ -110,7 +110,7 @@ dav_svn__get_deleted_rev_report(const da
   if (err)
     {
       svn_error_clear(err);
-      return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                            "Could not find revision path was deleted.");
     }
 

Modified: subversion/trunk/subversion/mod_dav_svn/reports/get-locks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/get-locks.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/get-locks.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/get-locks.c Wed Nov 10 16:00:56 2010
@@ -192,7 +192,7 @@ dav_svn__get_locks_report(const dav_reso
   /* The request URI should be a public one representing an fs path. */
   if ((! resource->info->repos_path)
       || (! resource->info->repos->repos))
-    return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                          "get-locks-report run on resource which doesn't "
                          "represent a path within a repository.");
 
@@ -209,7 +209,7 @@ dav_svn__get_locks_report(const dav_reso
               (depth != svn_depth_files) &&
               (depth != svn_depth_immediates) &&
               (depth != svn_depth_infinity))
-            return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                                  "Invalid 'depth' specified in "
                                  "get-locks-report request.");
           continue;

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Wed Nov 10 16:00:56 2010
@@ -880,7 +880,7 @@ prep_working(dav_resource_combined *comb
                                   comb->priv.root.activity_id);
       if (txn_name == NULL)
         {
-          return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+          return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                                "An unknown activity was specified in the URL. "
                                "This is generally caused by a problem in the "
                                "client software.");
@@ -896,7 +896,7 @@ prep_working(dav_resource_combined *comb
       if (serr->apr_err == SVN_ERR_FS_NO_SUCH_TRANSACTION)
         {
           svn_error_clear(serr);
-          return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+          return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                                "An activity was specified and found, but the "
                                "corresponding SVN FS transaction was not "
                                "found.");
@@ -956,7 +956,7 @@ prep_working(dav_resource_combined *comb
         }
       else if (!svn_string_compare(current_author, &request_author))
         {
-          return dav_new_error(pool, HTTP_NOT_IMPLEMENTED, 0,
+          return dav_svn__new_error(pool, HTTP_NOT_IMPLEMENTED, 0,
                    "Multi-author commits not supported.");
         }
     }
@@ -1011,7 +1011,7 @@ prep_private(dav_resource_combined *comb
       /* Open the named transaction. */
 
       if (comb->priv.root.txn_name == NULL)
-        return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                              "An unknown txn name was specified in the URL.");
 
       serr = svn_fs_open_txn(&comb->priv.root.txn,
@@ -1023,7 +1023,7 @@ prep_private(dav_resource_combined *comb
             {
               svn_error_clear(serr);
               comb->res.exists = FALSE;
-              return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+              return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                                    "Named transaction doesn't exist.");
             }
           return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -1074,7 +1074,7 @@ prep_resource(dav_resource_combined *com
         return (*scan->prep)(comb);
     }
 
-  return dav_new_error(comb->res.pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+  return dav_svn__new_error(comb->res.pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                        "DESIGN FAILURE: unknown resource type");
 }
 
@@ -1158,7 +1158,7 @@ dav_svn_split_uri(request_rec *r,
   if ((fs_path == NULL) && (fs_parent_path == NULL))
     {
       /* ### are SVN_ERR_APMOD codes within the right numeric space? */
-      return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+      return dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                            SVN_ERR_APMOD_MISSING_PATH_TO_FS,
                            "The server is misconfigured: "
                            "either an SVNPath or SVNParentPath "
@@ -1241,7 +1241,7 @@ dav_svn_split_uri(request_rec *r,
       if (relative[1] == '\0')
         {
           /* ### are SVN_ERR_APMOD codes within the right numeric space? */
-          return dav_new_error(r->pool, HTTP_FORBIDDEN,
+          return dav_svn__new_error(r->pool, HTTP_FORBIDDEN,
                                SVN_ERR_APMOD_MALFORMED_URI,
                                "The URI does not contain the name "
                                "of a repository.");
@@ -1289,7 +1289,7 @@ dav_svn_split_uri(request_rec *r,
         if (ch == '\0')
           {
             /* relative is just "!svn", which is malformed. */
-            return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+            return dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                                  SVN_ERR_APMOD_MALFORMED_URI,
                                  "Nothing follows the svn special_uri.");
           }
@@ -1316,7 +1316,7 @@ dav_svn_split_uri(request_rec *r,
                           *repos_path = NULL;
                         else
                           return
-                            dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+                            dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                                           SVN_ERR_APMOD_MALFORMED_URI,
                                           "Missing info after special_uri.");
                       }
@@ -1340,7 +1340,7 @@ dav_svn_split_uri(request_rec *r,
                             /* Did we break from the loop prematurely? */
                             if (j != (defn->numcomponents - 1))
                               return
-                                dav_new_error(r->pool,
+                                dav_svn__new_error(r->pool,
                                               HTTP_INTERNAL_SERVER_ERROR,
                                               SVN_ERR_APMOD_MALFORMED_URI,
                                               "Not enough components"
@@ -1361,7 +1361,7 @@ dav_svn_split_uri(request_rec *r,
                     else
                       {
                         return
-                          dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+                          dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                                         SVN_ERR_APMOD_MALFORMED_URI,
                                         "Unknown data after special_uri.");
                       }
@@ -1372,7 +1372,7 @@ dav_svn_split_uri(request_rec *r,
 
             if (defn->name == NULL)
               return
-                dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+                dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                               SVN_ERR_APMOD_MALFORMED_URI,
                               "Couldn't match subdir after special_uri.");
           }
@@ -1462,7 +1462,7 @@ get_parentpath_resource(request_rec *r,
                             "/", (char *)NULL);
       apr_table_setn(r->headers_out, "Location",
                      ap_construct_url(r->pool, new_uri, r));
-      return dav_new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
+      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
                            "Requests for a collection must have a "
                            "trailing slash on the URI.");
     }
@@ -1771,7 +1771,7 @@ parse_querystring(request_rec *r, const 
     {
       peg_rev = SVN_STR_TO_REV(prevstr);
       if (!SVN_IS_VALID_REVNUM(peg_rev))
-        return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                              "invalid peg rev in query string");
     }
   else
@@ -1788,7 +1788,7 @@ parse_querystring(request_rec *r, const 
     {
       working_rev = SVN_STR_TO_REV(wrevstr);
       if (!SVN_IS_VALID_REVNUM(working_rev))
-        return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                              "invalid working rev in query string");
     }
   else
@@ -1802,7 +1802,7 @@ parse_querystring(request_rec *r, const 
      Our node-tracing algorithms can't handle that scenario, so we'll
      disallow it here. */
   if (working_rev > peg_rev)
-    return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                          "working rev greater than peg rev.");
 
   /* If WORKING_REV and PEG_REV are equivalent, we want to return the
@@ -1844,7 +1844,7 @@ parse_querystring(request_rec *r, const 
 
       newpath = apr_hash_get(locations, &working_rev, sizeof(svn_revnum_t));
       if (! newpath)
-        return dav_new_error(pool, HTTP_NOT_FOUND, 0,
+        return dav_svn__new_error(pool, HTTP_NOT_FOUND, 0,
                              "path doesn't exist in that revision.");
 
       /* Redirect folks to a canonical, peg-revision-only location.
@@ -1857,7 +1857,7 @@ parse_querystring(request_rec *r, const 
                                                    comb->priv.repos->root_path,
                                                    newpath, working_rev),
                                       r));
-      return dav_new_error(r->pool,
+      return dav_svn__new_error(r->pool,
                            prevstr ? HTTP_MOVED_PERMANENTLY
                                    : HTTP_MOVED_TEMPORARILY,
                            0, "redirecting to canonical location");
@@ -2256,7 +2256,7 @@ get_resource(request_rec *r,
                                          (char *)NULL);
       apr_table_setn(r->headers_out, "Location",
                      ap_construct_url(r->pool, new_path, r));
-      return dav_new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
+      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
                            "Requests for a collection must have a "
                            "trailing slash on the URI.");
     }
@@ -2280,7 +2280,7 @@ get_resource(request_rec *r,
      doofus typed it in manually or has a buggy client. */
   /* ### pick something other than HTTP_INTERNAL_SERVER_ERROR */
   /* ### are SVN_ERR_APMOD codes within the right numeric space? */
-  return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
+  return dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
                        SVN_ERR_APMOD_MALFORMED_URI,
                        "The URI indicated a resource within Subversion's "
                        "special resource area, but does not exist. This is "
@@ -2387,7 +2387,7 @@ get_parent_resource(const dav_resource *
 
   /* If we didn't create parent resource above, complain. */
   if (! *parent_resource)
-    return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                          apr_psprintf(resource->pool,
                                       "get_parent_resource was called for "
                                       "%s (type %d)",
@@ -2610,7 +2610,7 @@ open_stream(const dav_resource *resource
     {
       if (resource->type != DAV_RESOURCE_TYPE_WORKING)
         {
-          return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+          return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                                "Resource body changes may only be made to "
                                "working resources [at this time].");
         }
@@ -2619,7 +2619,7 @@ open_stream(const dav_resource *resource
 #if 1
   if (mode == DAV_MODE_WRITE_SEEKABLE)
     {
-      return dav_new_error(resource->pool, HTTP_NOT_IMPLEMENTED, 0,
+      return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED, 0,
                            "Resource body writes cannot use ranges "
                            "[at this time].");
     }
@@ -2814,7 +2814,7 @@ seek_stream(dav_stream *stream, apr_off_
 {
   /* ### fill this in */
 
-  return dav_new_error(stream->res->pool, HTTP_NOT_IMPLEMENTED, 0,
+  return dav_svn__new_error(stream->res->pool, HTTP_NOT_IMPLEMENTED, 0,
                        "Resource body read/write cannot use ranges "
                        "(at this time)");
 }
@@ -3110,7 +3110,7 @@ deliver(const dav_resource *resource, ap
       && resource->type != DAV_RESOURCE_TYPE_WORKING
       && resource->info->restype != DAV_SVN_RESTYPE_PARENTPATH_COLLECTION)
     {
-      return dav_new_error(resource->pool, HTTP_CONFLICT, 0,
+      return dav_svn__new_error(resource->pool, HTTP_CONFLICT, 0,
                            "Cannot GET this type of resource.");
     }
 
@@ -3429,7 +3429,7 @@ deliver(const dav_resource *resource, ap
       bkt = apr_bucket_eos_create(output->c->bucket_alloc);
       APR_BRIGADE_INSERT_TAIL(bb, bkt);
       if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS)
-        return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Could not write EOS to filter.");
 
       return NULL;
@@ -3476,7 +3476,7 @@ deliver(const dav_resource *resource, ap
                                         "is really a file",
                                         resource->pool);
           if (!is_file)
-            return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                                  "the delta base does not refer to a file");
 
           /* Okay. Let's open up a delta stream for the client to read. */
@@ -3563,7 +3563,7 @@ deliver(const dav_resource *resource, ap
         APR_BRIGADE_INSERT_TAIL(bb, bkt);
         if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) {
           /* ### what to do with status; and that HTTP code... */
-          return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+          return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                                "Could not write data to filter.");
         }
       }
@@ -3574,7 +3574,7 @@ deliver(const dav_resource *resource, ap
       APR_BRIGADE_INSERT_TAIL(bb, bkt);
       if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) {
         /* ### what to do with status; and that HTTP code... */
-        return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Could not write EOS to filter.");
       }
 
@@ -3592,7 +3592,7 @@ create_collection(dav_resource *resource
   if (resource->type != DAV_RESOURCE_TYPE_WORKING
       && resource->type != DAV_RESOURCE_TYPE_REGULAR)
     {
-      return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+      return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                            "Collections can only be created within a working "
                            "or regular collection [at this time].");
     }
@@ -3600,7 +3600,7 @@ create_collection(dav_resource *resource
   /* ...regular resources allowed only if autoversioning is turned on. */
   if (resource->type == DAV_RESOURCE_TYPE_REGULAR
       && ! (resource->info->repos->autoversioning))
-    return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                          "MKCOL called on regular resource, but "
                          "autoversioning is not active.");
 
@@ -3664,7 +3664,7 @@ copy_resource(const dav_resource *src,
       (src->pool, "Got a COPY request with src arg '%s' and dst arg '%s'",
       src->uri, dst->uri);
 
-      return dav_new_error(src->pool, HTTP_NOT_IMPLEMENTED, 0, msg);
+      return dav_svn__new_error(src->pool, HTTP_NOT_IMPLEMENTED, 0, msg);
   */
 
   /* ### Safeguard: see issue #916, whereby we're allowing an
@@ -3672,12 +3672,12 @@ copy_resource(const dav_resource *src,
      a new baseline afterwards.  We need to safeguard here that nobody
      is calling COPY with the baseline as a Destination! */
   if (dst->baselined && dst->type == DAV_RESOURCE_TYPE_VERSION)
-    return dav_new_error(src->pool, HTTP_PRECONDITION_FAILED, 0,
+    return dav_svn__new_error(src->pool, HTTP_PRECONDITION_FAILED, 0,
                          "Illegal: COPY Destination is a baseline.");
 
   if (dst->type == DAV_RESOURCE_TYPE_REGULAR
       && !(dst->info->repos->autoversioning))
-    return dav_new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                          "COPY called on regular resource, but "
                          "autoversioning is not active.");
 
@@ -3748,13 +3748,13 @@ remove_resource(dav_resource *resource, 
          || resource->type == DAV_RESOURCE_TYPE_ACTIVITY
          || (resource->type == DAV_RESOURCE_TYPE_PRIVATE
              && resource->info->restype == DAV_SVN_RESTYPE_TXN_COLLECTION)))
-    return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                            "DELETE called on invalid resource type.");
 
   /* ...and regular resources only if autoversioning is turned on. */
   if (resource->type == DAV_RESOURCE_TYPE_REGULAR
       && ! (resource->info->repos->autoversioning))
-    return dav_new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                          "DELETE called on regular resource, but "
                          "autoversioning is not active.");
 
@@ -3889,7 +3889,7 @@ move_resource(dav_resource *src,
   if (src->type != DAV_RESOURCE_TYPE_REGULAR
       || dst->type != DAV_RESOURCE_TYPE_REGULAR
       || !(src->info->repos->autoversioning))
-    return dav_new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                          "MOVE only allowed on two public URIs, and "
                          "autoversioning must be active.");
 
@@ -3984,7 +3984,7 @@ do_walk(walker_ctx_t *ctx, int depth)
   /* ### need to allow more walking in the future */
   if (params->root->type != DAV_RESOURCE_TYPE_REGULAR)
     {
-      return dav_new_error(params->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+      return dav_svn__new_error(params->pool, HTTP_METHOD_NOT_ALLOWED, 0,
                            "Walking the resource hierarchy can only be done "
                            "on 'regular' resources [at this time].");
     }
@@ -4298,7 +4298,7 @@ dav_svn__create_version_resource(dav_res
 
   result = parse_version_uri(comb, uri, NULL, 0);
   if (result != 0)
-    return dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                          "Could not parse version resource uri.");
 
   err = prep_version(comb);
@@ -4326,11 +4326,11 @@ handle_post_request(request_rec *r,
   status = dav_svn__parse_request_skel(&request_skel, r, pool);
 
   if (status != OK)
-    return dav_new_error(pool, status, 0,
+    return dav_svn__new_error(pool, status, 0,
                          "Error parsing skel POST request body.");
 
   if (svn_skel__list_length(request_skel) < 1)
-    return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                          "Unable to identify skel POST request flavor.");
 
   if (svn_skel__matches_atom(request_skel->children, "create-txn"))
@@ -4339,7 +4339,7 @@ handle_post_request(request_rec *r,
     }
   else
     {
-      return dav_new_error(pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
                            "Unsupported skel POST request flavor.");
     }
   /* NOTREACHED */
@@ -4368,7 +4368,7 @@ int dav_svn__method_post(request_rec *r)
     }
   else
     {
-      derr = dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+      derr = dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                            "Unsupported POST request type.");
     }
 

Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Wed Nov 10 16:00:56 2010
@@ -39,6 +39,27 @@
 
 
 dav_error *
+dav_svn__new_error(apr_pool_t *pool,
+                   int status,
+                   int error_id,
+                   const char *desc)
+{
+/*
+ * Note: dav_new_error() in httpd 2.0/2.2 always treated
+ * the errno field in dav_error as an apr_status_t when
+ * logging; on some platforms errno and apr_status_t
+ * aren't directly interchangeable.  The code for httpd
+ * > 2.2 below perpetuates this.
+ */
+#if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
+  /* old code assumed errno was valid; keep assuming */
+  return dav_new_error(pool, status, error_id, errno, desc);
+#else
+  return dav_new_error(pool, status, error_id, desc);
+#endif
+}
+
+dav_error *
 dav_svn__new_error_tag(apr_pool_t *pool,
                        int status,
                        int error_id,
@@ -46,6 +67,10 @@ dav_svn__new_error_tag(apr_pool_t *pool,
                        const char *namespace,
                        const char *tagname)
 {
+#if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
+  return dav_new_error_tag(pool, status, error_id, 0,
+                           desc, namespace, tagname);
+#else
   /* dav_new_error_tag will record errno but Subversion makes no attempt
      to ensure that it is valid.  We reset it to avoid putting incorrect
      information into the error log, at the expense of possibly removing
@@ -53,6 +78,7 @@ dav_svn__new_error_tag(apr_pool_t *pool,
   errno = 0;
 
   return dav_new_error_tag(pool, status, error_id, desc, namespace, tagname);
+#endif
 }
 
 
@@ -573,7 +599,7 @@ dav_svn__final_flush_or_error(request_re
     {
       apr_status_t apr_err = ap_fflush(output, bb);
       if (apr_err && (! derr))
-        derr = dav_new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        derr = dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Error flushing brigade.");
     }
   return derr;

Modified: subversion/trunk/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/version.c?rev=1033547&r1=1033546&r2=1033547&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/version.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/version.c Wed Nov 10 16:00:56 2010
@@ -83,7 +83,7 @@ set_auto_revprops(dav_resource *resource
 
   if (! (resource->type == DAV_RESOURCE_TYPE_WORKING
          && resource->info->auto_checked_out))
-    return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                          "Set_auto_revprops called on invalid resource.");
 
   if ((serr = dav_svn__attach_auto_revprops(resource->info->root.txn,
@@ -301,7 +301,7 @@ vsn_control(dav_resource *resource, cons
   /* All mod_dav_svn resources are versioned objects;  so it doesn't
      make sense to call vsn_control on a resource that exists . */
   if (resource->exists)
-    return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                          "vsn_control called on already-versioned resource.");
 
   /* Only allow a NULL target, which means an create an 'empty' VCR. */
@@ -413,7 +413,7 @@ dav_svn__checkout(dav_resource *resource
           shared_txn_name = dav_svn__get_txn(resource->info->repos,
                                              shared_activity);
           if (! shared_txn_name)
-            return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+            return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                                  "Cannot look up a txn_name by activity");
         }
 
@@ -889,19 +889,19 @@ dav_svn__checkin(dav_resource *resource,
       shared_txn_name = dav_svn__get_txn(resource->info->repos,
                                          shared_activity);
       if (! shared_txn_name)
-        return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Cannot look up a txn_name by activity");
 
       /* Sanity checks */
       if (resource->info->root.txn_name
           && (strcmp(shared_txn_name, resource->info->root.txn_name) != 0))
-        return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Internal txn_name doesn't match"
                              " autoversioning transaction.");
 
       if (! resource->info->root.txn)
         /* should already be open by checkout */
-        return dav_new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
                              "Autoversioning txn isn't open "
                              "when it should be.");