summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-04 08:39:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-04 08:39:57 +0000
commita9e9697994a08600f5dbb46a1fe2a07233cb4890 (patch)
tree9976842c343a888dc34f5cc53ecedc5abb358669 /ext/dbm
parent0d684beafb4258da9606b1e3b4448511b709a2e2 (diff)
19991104
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/dbm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 4d83cec..1240f4b 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -72,12 +72,16 @@ fdbm_s_open(argc, argv, klass)
Check_SafeStr(file);
dbm = 0;
- if (mode >= 0)
+ if (mode >= 0) {
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
- if (!dbm)
+ }
+ if (!dbm) {
+ mode = 0666;
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, mode);
- if (!dbm)
+ }
+ if (!dbm) {
dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
+ }
if (!dbm) {
if (mode == -1) return Qnil;