diff options
Diffstat (limited to 'ext/dbm/dbm.c')
-rw-r--r-- | ext/dbm/dbm.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index 4d83cec1b..1240f4b9a 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; |