Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* ext/dbm/dbm.c (fdbm_initialize): disable Berkeley DB error messages.

* ext/dbm/extconf.rb: check DBC type for above.

[ruby-dev:45269]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit eac1d9cfcad5d2d56951e540eb7023eccf7a3593 1 parent ca9b0f5
@akr akr authored
Showing with 19 additions and 0 deletions.
  1. +8 −0 ChangeLog
  2. +6 −0 ext/dbm/dbm.c
  3. +5 −0 ext/dbm/extconf.rb
View
8 ChangeLog
@@ -1,3 +1,11 @@
+Wed Feb 22 06:02:42 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c (fdbm_initialize): disable Berkeley DB error messages.
+
+ * ext/dbm/extconf.rb: check DBC type for above.
+
+ [ruby-dev:45269]
+
Tue Feb 21 20:23:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (rb_any_hash): treat Qundef like as other special constants.
View
6 ext/dbm/dbm.c
@@ -196,6 +196,12 @@ fdbm_initialize(int argc, VALUE *argv, VALUE obj)
#if defined(HAVE_DBM_DIRFNO)
rb_fd_fix_cloexec(dbm_dirfno(dbm));
#endif
+
+#if defined(_DB_H_) && defined(HAVE_TYPE_DBC)
+ /* Disable Berkeley DB error messages such as:
+ * DB->put: attempt to modify a read-only database */
+ ((DBC*)dbm)->dbp->set_errfile(((DBC*)dbm)->dbp, NULL);
+#endif
}
if (!dbm) {
View
5 ext/dbm/extconf.rb
@@ -222,6 +222,11 @@ def headers.db_check2(db, hdr)
return false
end
+ # DBC type is required to disable error messages by Berkeley DB 2 or later.
+ if have_db_header
+ have_type("DBC", hdr, hsearch)
+ end
+
if hsearch
$defs << hsearch
@defs = hsearch
Please sign in to comment.
Something went wrong with that request. Please try again.