Browse Source

This fixes the notorious "mode 'c' fails" bug (see bugs - 10380, 10798, 11732). The bug originates from the fact that mode "c" for db3 sets 'type' to DB_UNKNOWN and mode DB_CREATE when the database already exists. The underlying library raises an error at this logical discrepancy: obviously one cannot create a database of unknown type.

experimental/ZendEngine2
Gavin Sherry 24 years ago
parent
commit
8f30e5f619
  1. 6
      ext/dba/dba_db3.c

6
ext/dba/dba_db3.c

@ -49,13 +49,15 @@ DBA_OPEN_FUNC(db3)
int gmode = 0;
int filemode = 0644;
struct stat check_stat;
int s = VCWD_STAT(info->path, &check_stat);
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
VCWD_STAT(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN;
s? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
info->mode == DBA_CREAT ? DB_CREATE :
(info->mode == DBA_CREAT && s) ? DB_CREATE :
(info->mode == DBA_CREAT && !s) ? 0 :
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;

Loading…
Cancel
Save