--- apr-util/dbm/apr_dbm_berkeleydb.c.orig	2002-12-04 21:53:07.000000000 +0100
+++ apr-util/dbm/apr_dbm_berkeleydb.c	2002-12-05 20:35:36.000000000 +0100
@@ -73,9 +73,7 @@
  */
 
 #if   defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4)
-/* At this time, there are no differences from our perspective between
- * DB3 and DB4. */
-#define DB_VER 3
+#define DB_VER 4
 #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
 #define DB_VER 3
 #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
@@ -193,7 +191,17 @@
     {
         int dberr;
 
-#if DB_VER == 3
+#if DB_VER == 4 && DB_VERSION_MINOR >= 1
+        if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
+            if ((dberr = (*file.bdb->open)(file.bdb, NULL, pathname, NULL, 
+                                           DB_HASH, dbmode, 
+                                           apr_posix_perms2mode(perm))) != 0) {
+                /* close the DB handler */
+                (void) (*file.bdb->close)(file.bdb, 0);
+            }
+        }
+        file.curs = NULL;
+#elif DB_VER == 3
         if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
             if ((dberr = (*file.bdb->open)(file.bdb, pathname, NULL, 
                                            DB_HASH, dbmode, 
@@ -339,7 +347,7 @@
     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
+#if (DB_VER == 3 || DB_VER == 4)
                                 , 0
 #elif (DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5) 
                                 , 0
