--- srclib/apr-util/dbm/apr_dbm_berkeleydb.c.orig	Wed Mar 13 21:40:47 2002
+++ srclib/apr-util/dbm/apr_dbm_berkeleydb.c	Sat Jan 11 09:42:45 2003
@@ -73,9 +73,14 @@
  */
 
 #if   defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4)
-/* At this time, there are no differences from our perspective between
- * DB3 and DB4. */
+/* We will treat anything greater than 4.1 as DB4.
+ * We can treat 4.0 as DB3.
+ */
+#if   defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1)
+#define DB_VER 4
+#else
 #define DB_VER 3
+#endif
 #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
 #define DB_VER 3
 #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
@@ -193,9 +198,13 @@
     {
         int dberr;
 
-#if DB_VER == 3
+#if DB_VER >= 3
         if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
-            if ((dberr = (*file.bdb->open)(file.bdb, pathname, NULL, 
+            if ((dberr = (*file.bdb->open)(file.bdb,
+#if DB_VER == 4
+                                           NULL,
+#endif
+                                           pathname, NULL, 
                                            DB_HASH, dbmode, 
                                            apr_posix_perms2mode(perm))) != 0) {
                 /* close the DB handler */
@@ -339,11 +348,8 @@
     dberr = (*f->bdb->seq)(f->bdb, &first, &data, R_FIRST);
 #else
     if ((dberr = (*f->bdb->cursor)(f->bdb, NULL, &f->curs
-#if DB_VER == 3
-                                , 0
-#elif (DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5) 
-                                , 0
-
+#if DB_VER >= 3 || ((DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5))
+                                   , 0
 #endif
              )) == 0) {
         dberr = (*f->curs->c_get)(f->curs, &first, &data, DB_FIRST);
