You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/07/19 04:47:41 UTC

svn commit: r1148131 - /subversion/trunk/subversion/libsvn_ra_serf/serf.c

Author: gstein
Date: Tue Jul 19 02:47:40 2011
New Revision: 1148131

URL: http://svn.apache.org/viewvc?rev=1148131&view=rev
Log:
Confirm that we have loaded a compatible serf library, relative to what we
were compiled against.

* subversion/libsvn_ra_serf/serf.c:
  (svn_ra_serf__init): fetch serf's (runtime) version and compare it
    against the compile-time version.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/serf.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1148131&r1=1148130&r2=1148131&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Tue Jul 19 02:47:40 2011
@@ -1087,6 +1087,9 @@ svn_ra_serf__init(const svn_version_t *l
       { "svn_delta", svn_delta_version },
       { NULL, NULL }
     };
+  int serf_major;
+  int serf_minor;
+  int serf_patch;
 
   SVN_ERR(svn_ver_check_list(ra_serf_version(), checklist));
 
@@ -1094,12 +1097,27 @@ svn_ra_serf__init(const svn_version_t *l
      VTABLE parameter. The RA loader does a more exhaustive check. */
   if (loader_version->major != SVN_VER_MAJOR)
     {
-      return svn_error_createf
-        (SVN_ERR_VERSION_MISMATCH, NULL,
+      return svn_error_createf(
+         SVN_ERR_VERSION_MISMATCH, NULL,
          _("Unsupported RA loader version (%d) for ra_serf"),
          loader_version->major);
     }
 
+  /* Make sure that we have loaded a compatible library: the MAJOR must
+     match, and the minor must be at *least* what we compiled against.
+     The patch level is simply ignored.  */
+  serf_lib_version(&serf_major, &serf_minor, &serf_patch);
+  if (serf_major != SERF_MAJOR_VERSION
+      || serf_minor < SERF_MINOR_VERSION)
+    {
+      return svn_error_createf(
+         SVN_ERR_VERSION_MISMATCH, NULL,
+         _("ra_serf was compiled for serf %d.%d.%d but loaded "
+           "an incompatible %d.%d.%d library"),
+         SERF_MAJOR_VERSION, SERF_MINOR_VERSION, SERF_PATCH_VERSION,
+         serf_major, serf_minor, serf_patch);
+    }
+
   *vtable = &serf_vtable;
 
   return SVN_NO_ERROR;