Skip to content

Commit eac1d9c

Browse files
committed
* 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
1 parent ca9b0f5 commit eac1d9c

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Wed Feb 22 06:02:42 2012 Tanaka Akira <akr@fsij.org>
2+
3+
* ext/dbm/dbm.c (fdbm_initialize): disable Berkeley DB error messages.
4+
5+
* ext/dbm/extconf.rb: check DBC type for above.
6+
7+
[ruby-dev:45269]
8+
19
Tue Feb 21 20:23:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
210

311
* hash.c (rb_any_hash): treat Qundef like as other special constants.

ext/dbm/dbm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ fdbm_initialize(int argc, VALUE *argv, VALUE obj)
196196
#if defined(HAVE_DBM_DIRFNO)
197197
rb_fd_fix_cloexec(dbm_dirfno(dbm));
198198
#endif
199+
200+
#if defined(_DB_H_) && defined(HAVE_TYPE_DBC)
201+
/* Disable Berkeley DB error messages such as:
202+
* DB->put: attempt to modify a read-only database */
203+
((DBC*)dbm)->dbp->set_errfile(((DBC*)dbm)->dbp, NULL);
204+
#endif
199205
}
200206

201207
if (!dbm) {

ext/dbm/extconf.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ def headers.db_check2(db, hdr)
222222
return false
223223
end
224224

225+
# DBC type is required to disable error messages by Berkeley DB 2 or later.
226+
if have_db_header
227+
have_type("DBC", hdr, hsearch)
228+
end
229+
225230
if hsearch
226231
$defs << hsearch
227232
@defs = hsearch

0 commit comments

Comments
 (0)