File: dbm_read_hash_or_btree.patch

package info (click to toggle)
apr-util 1.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,912 kB
  • sloc: ansic: 39,055; sh: 10,713; makefile: 288; perl: 154; xml: 36
file content (33 lines) | stat: -rw-r--r-- 1,277 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Adam Conrad <adconrad@0c3.net>
Subject: Be more liberal in the types of DBM files we accept.

---
 dbm/apr_dbm_berkeleydb.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: trunk/dbm/apr_dbm_berkeleydb.c
===================================================================
--- trunk.orig/dbm/apr_dbm_berkeleydb.c
+++ trunk/dbm/apr_dbm_berkeleydb.c
@@ -174,6 +174,21 @@
                                            apr_posix_perms2mode(perm))) != 0) {
                 /* close the DB handler */
                 (void) (*file.bdb->close)(file.bdb, 0);
+                if (dberr == EINVAL) {
+                   if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
+                       if ((dberr = (*file.bdb->open)(file.bdb,
+#if DB_VER == 4
+                                               NULL,
+#endif
+                                               pathname, NULL,
+                                               DB_BTREE, dbmode,
+                                               apr_posix_perms2mode(perm))) != 0) {
+
+                            /* close the DB handler */
+                            (void) (*file.bdb->close)(file.bdb, 0);
+                       }
+		    }
+                }
             }
         }
         file.curs = NULL;